in reply to Re^2: Date plus Time sort from file
in thread Date plus Time sort from file

Based on what was just said, my example can be simplified even further:

# this is what should be used instead of the hard-coded value: # my $today = strftime("%m-%d-%Y",localtime()); my $today = '08-14-2013'; my @todays; for ( @orig_data ) { next unless m/^($today )/; push(@todays,$_); } # NOTE! this will reverse the order of Yes and No if they have the # same time. @todays = sort(@todays); for ( @todays ) { print "$_\n"; }

I agree that filtering then sorting will result in (sometimes large) performance gains. In this particular case, where the unsorted array is actually records coming from a file, you only want to store the records of interest in memory instead of slurping in the entire file. RAM might be cheap, but it is a finite resource and SAs can be a nasty breed of cat. (Remember the BOFH?)