in reply to Numeric summarisation from data in a hash?

My idea of solving this is putting the intervals into an array and then selecting the "right" bucket for the length. I assume that you can somehow get at the playlength of a file in seconds. (untested code follows):

my @playlengths = ( 0, 1*60, 2*60, 3*60, 4*60, 5*60, # this is just to show 10*60, # that we can have gaps in the array 60*60, # and anything longer than one hour # goes into this bucket ... 2147483648, # I use this as an easy end-of-array marker ); # First we retrieve the playlength in seconds # from the current file for later reference my $playlength = &getPlaylength( $file{$pos}); # $slot will hold the position of our file # so @playlengths[$slot] <= $playlength < $playlengths[$slot+1] # always holds my $slot = 0; while ($playlength < @playlengths[$slot]) { $slot++; }; if ($slot == $#playlengths) { print "The file playlength is longer than $playlengths[$slot] second +s.\n"; } elsif ($slot == 0) { print "The file playlength is below ",$playlengths[1]," seconds.\n"; } else { print "The file playlength is between $playlengths[$slot] and $playle +ngths[$slot+1] seconds." };