my @clips; foreach (keys %file) { push @{$clips[int($file{$_}{VLENGTH})]}, $file{$_}{TITLE}; } foreach (0 .. $#clips) { print "There are ", scalar @{$clips[$_]}, " clips between $_ -", $_ + 1, " mins\n"; } foreach (0 .. $#clips) { print "Names of clips between $_ - ", $_ + 1, " mins: ", @{$clips[$_]}, "\n"; }