http://qs321.pair.com?node_id=624017


in reply to Extract the middle part of a list

You want grep, with some data extraction in the choice routine.

our ($starttime, $endtime) = init(); # . . . my @selected = grep { my $time = (split /[_.]/)[2]; $time > $starttime and $time <= $endtime;; } </path/to/*>;
Not having to sort helps, since we don't need to keep values for comparison. If there are files there which don't follow the naming scheme, you may need to filter them out with another grep or with map, or a refinement of the glob in angles.

After Compline,
Zaxo