#!/bin/perl
use strict; 
use warnings;

#20Apr2013 -> 20130420
#This makes sort by name == sort by date
#regardless of timestamp.  So, fix timestamp 
#while you're at it.

my @months=qw(Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec);
my %months;

foreach my $i ( 0..11 ) { 
    $months{$months[$i]}=$i;
    #printf "%%months{%s}: %s\n", $months[$i],$months{$months[$i]};
}

while(<>){
    chomp;
    my $od=$_;
    my $day=substr($od,0,2);
    my $month=substr($od,2,3); #'Apr'
    my $mon=$months{$month}+1; #need a hash here, key -> number.
    my $year=substr($od,5,4);

    my $cmd=sprintf "ln -s %s %4s%02s%02s",$od,$year,$mon,$day;
    printf "%s\n",$cmd;
}
__DATA__
20Apr2013
