Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8991497
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T22:44:27+00:00 2026-06-15T22:44:27+00:00

I am writing a small perl script to re-tag my MP3 collection based on

  • 0

I am writing a small perl script to re-tag my MP3 collection based on the filenames.

#!/usr/bin/perl

use strict;
use warnings;
use MP3::Tag;
use File::Find;

MP3::Tag->config(write_v24 => 1);
my $dirpath = "../MP3s/";
finddepth(\&wanted, $dirpath);
sub wanted {
    unless (-d $_) {
        my ($track,$artist,$title);
        if(($track,$artist,$title) = ($_ =~ m/(\d+) - (.+?) - (.+)\.mp3$/g)){
            #handle songs with a track number
            my $mp3 = MP3::Tag->new($_) or die $!;

            $mp3->track_set($track);
            $mp3->artist_set($artist);
            $mp3->title_set($title);
            $File::Find::dir =~ m/.*\/(.*)/;
            $mp3->album_set($1);
            $mp3->update_tags();
            $mp3->close();
            print "$track - $artist - $title\n";
        } elsif(($artist,$title) = ($_ =~ m/(.+?) - (.+)\.mp3$/g)){
            #handle songs without a track number
            my $mp3 = MP3::Tag->new($_) or die $!;

            $mp3->track_set("");
            $mp3->artist_set($artist);
            $mp3->title_set($title);
            $mp3->update_tags();
            $mp3->close();
            print "$artist - $title\n";
        }
    }   
}

This works fine, but there are some files which make the script crash with this error:
UTF-16:Unrecognised BOM 3100 at C:/strawberry/perl/lib/Encode.pm line 175.

What causes this error? The filename doesn’t have special characters like german umlauts (ä,ö,ü).

How can I resolve this problem or skip such files?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T22:44:28+00:00Added an answer on June 15, 2026 at 10:44 pm

    You should start by adding use Carp::Always that will give you a stack trace showing you which statement in your own program was fatal.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am writing small process monitor script in Perl by reading values from Proc
I'm writing a small RMI based Chat application. The idea is: the Client registers
I'm writing a small web application using Perl, HTML::Mason and Apache. I've been using
I am writing a script in Perl which searches for a motif(substring) in protein
I'm writing small VB.Net app which should build reports based on data gathered from
I am writing small game and I need to read off text file, write
im writing a small calendar based on php and jquery which has the a
I am writing a Perl script that is searching for a term in large
I am writing a small program in Perl for my assignment and I am
I am writing a Perl based application that converts an SQLite database into an

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.