http://www.perlmonks.org?node_id=922231

StarkRavingCalm has asked for the wisdom of the Perl Monks concerning the following question:

Hello monks,

I am trying to find a script to read .mp3s and their tags. I have no need to write or re-write tags.

My first step is to have script read mp3's but for some reason, I cannot get one to work from any that I have found. I have included an example from your site.

Script hangs with no output or, if using strict, throws error of:

"Global symbol "@info" requires explicit package name at"

NOTE: Features I would like to have are:

List all mp3 files and their tags as well as any without tags (this should say something like "no tag found" or something)

List files missing certain tag elements (i.e. photo)

Here's the code:

Thanks!

#!/usr/bin/perl -w use MP3::Tag; # define how autoinfo tries to get information # default: # MP3::Tag->config("autoinfo","ID3v2","ID3v1","filename"); # don't use ID3v2: # MP3::Tag->config("autoinfo","ID3v1","filename"); while (<STDIN>) { chomp; if (my $mp3=MP3::Tag->new($_)) { print "$_ (Tags: ", join(", ",$mp3->get_tags),")\n"; @info=$mp3->autoinfo; print "* Song: $info[0]\n"; print "* Track: $info[1]\n"; print "* Artist: $info[2]\n"; print "* Album: $info[3]\n"; print "* Comment: $info[4]\n"; } }