#!/usr/bin/perl # https://perlmonks.org/?node_id=1232659 use strict; use warnings; use List::Util qw( reduce ); my %hashName = (a => 1, b => 3, c => 3); sub allmax { reduce { $a->[-1] > $b->[-1] ? $a : $a->[-1] < $b->[-1] ? $b : [ @{$a}[0..@$a-2], @$b ] } @_; } my $maxref = allmax( map [ $_, $hashName{$_} ], sort keys %hashName ); print "@$maxref\n";