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


in reply to Convert date into day and month

You could use a hash that maps the month name to a number and then use a regex to change the date string.

Example:
#!/usr/bin/perl use strict; use warnings; my %mon2num = ( Sept => 9, Oct => 10, Nov => 11, # etc ); while (<DATA>) { chomp; my ($date, $file_name) = split(/,/); $date =~ s/(\S+)\s(\S+)\s(\S+)/$2 $mon2num{$1} $3/; print "$date\n"; } __DATA__ Oct 31 08:30,file1 Nov 25 17:30,file2 Sept 09 12:00,file3