in reply to sorting by month within year

The simplest solution, but not the most effective would be to just sort a hash of the month and year... check code.

#this is assuming you are in the right directory #this is not the most efficient way of getting a list of files foreach (<*.*>) { my($month,$year)=split(/\d{2}/,$_); $year+=1900; #Assuming that year started after 1990 if($year<90){$year+=100;} $NEWSLETTER{$year}{$month} = 0; } foreach $y (sort keys %NEWSLETTER) { foreach $m (sort keys $NEWSLETTER{$y}) { #insert code for what you want to do with the sorted year and mo +nth.... } }

"The pajamas do not like to eat large carnivore toasters."
In German: "Die Pyjamas mögen nicht große Tiertoaster essen.
In Spanish: "Los pijamas no tienen gusto de comer las tostadoras grandes del carnívoro."