First, like all non-standard Perl modules, you will need to install MP3::Tag from CPAN, and then you can include it at the top of your Perl programs with the use statement:
use MP3::Tag;Then you can load up an MP3 file and grab the file information with some pre-made functions like autoinfo:
$mp3 = MP3::Tag->new($filename);Or you can use the get_tags function to grab the fill ID3 tags and read them:
($title, $track, $artist, $album, $comment, $year, $genre) = $mp3->autoinfo();
$mp3->get_tags;For ID3v1 and ID3v2 tags, you can even change or delete the values, giving you a powerful processing tool if you need to edit large batches of MP3 or just want to make sure your tags are nice and clean. Module Links:
if (exists $mp3->{ID3v1}) {
print $mp3->{ID3v1};
}
if (exists $mp3->{ID3v2}) {
print $mp3->{ID3v2};
}
