@data = map { $_->[0] } sort { $a->[3] <=> $b->[3] # YY ||$a->[1] <=> $b->[1] # MM ||$a->[2] <=> $b->[2]} # DD map { [ m!^\s*(\D*(\d+)/(\d+)/(\d+)(?: [\d.]+)*)\s*$! ] } @idata; # 0 1MM 2DD 3YY #### @data = sort { $a->[1] cmp $b->[1] } # Sort by YYYY/MM/DD map { my @p=m!^\s*([A-Za-z]+)\s+ # alpha word (\d+)/(\d+)/(\d+) # date MM DD YY (?:\s+([\d.]+)) # Substitute Number regex here (?:\s+([\d.]+)) # .. (?:\s+([\d.]+)) # .. (?:\s+([\d.]+))!x; # Comments please # Fix the date if this is still in use in 2050... splice @p,1,3,sprintf("%04d/%02d/%02d", ($p[3]>50 ? $p[3]+1900 : $p[3]+2000), @p[1,2]); # it deserves to produce incorrect results, after all # 2 digit dates is madness \@p} # return the fixed array @idata; #### @data = map {substr($_,3)} sort #lexicographical representation of the date map { m!^\s*(\D*(\d+)/(\d+)/(\d+)(?: [\d.]+)*)\s*$! && pack ("CCCA*",$4,$2,$3,$1)} @idata;