in reply to How to randomly select a key whose value is between a range?

Construct the list of keys which have values within your desired range. Pull a random key out of that list, and you're done!
#!/usr/bin/perl # Libraries use strict; use warnings; # User-defined my $min = 2; my $max = 5; my %hash = ( a => 00, b => 01, c => 02, d => 03, e => 04, f => 05, g => 06 ); # Main program my @match = grep { $hash{$_} >= $min and $hash{$_} <= $max } keys %has +h; my $rand = $match[rand @match]; printf "Random key = '%s', Value = '%s'\n", $rand, $hash{$rand};
say  substr+lc crypt(qw $i3 SI$),4,5