in reply to hash map to give preference to 1st match

I think you're using the wrong data structure. Hashes cannot have duplicate keys, and floating point numbers are a bad match for hash keys, anyway. Like: "0.456234" and "0.4562340" is the same numerical value, yet it's a different string (and thus: hash key).

I'd rather use an array of (value, url) tuples (maybe as anonymous arrays... With 2 loops, you can

  1. determine the max value
  2. fetch all tuples with that value.
Actually, if you do it smarter (but more complex), you can do it in one loop.
my @pairs = ([0.456234, 'url 1'], [0.42323, 'url 2'], [0.456234, 'url +3'], [0.456234, 'url 4']); my $max; my @url; foreach(@pairs) { if(!defined $max or $max < $_->[0]) { $max = $_->[0]; @url = $_->[1]; } elsif($max == $_->[0]) { # caution: exact identity with floati +ng point numbers is rare, so this might disappoint a little push @url, $_->[1]; } } use Data::Dumper; print Dumper (\@url);
p.s. your original data is wrong, as it's the second value that is the highest. I modified that value in my test code.