First off, why are you doing two sorts?
Sorts are pretty damn expensive (or so I'm told).
Especially in this case, I would imagine, since
hash lookups on anagrams (act, atc, cat, cta, tat, tca) are particularly slow.
Being timestamps they are restricted to a 10 character
set, and most likely be all of the same length,
thusly ensuring that a portion of a decent sized will be anagrams.
($j, $l) = (sort keys %master)[0,-1];
Second
#Might go with a C-style for-loop here.
while($j <= $l){
for my $elem (qw(CCMT ...)){
$out .= "," . ($master{$j}{$elem} || '0');
}
$j+=60;
}
--
perl -pe "s/\b;([mnst])/'\1/mg"