Tag Archives: Perl

Get DateTime in YYYY-mm-dd HH:MM:SS format using Perl

For many years I’ve been using the long process of obtaining everything from localtime(), adding 1900 to the year etc. etc. but I’ve just come across the method below, which uses strftime from the POSIX module. use POSIX;   my $DateTime = strftime "%F %T", localtime $^T; This gives you: 2006-10-02 02:06:07 Now that’s a [...]

Read MP3 ID3 Tags in Perl

The package I use for simple tag reading is MP3::Tag, available on CPAN with more information here. The following example shows how easy it is to retrieve tags from an MP3 file. use MP3::Tag;   my $file = MP3::Tag->new($filename);   my ($title, $track, $artist, $album, $comment, $year, $genre) = $file->autoinfo();   print "Title: [$title]\n"; print [...]