#!/usr/bin/perl -w use strict; use warnings; use List::Util qw (max); my %hash = ( 1 => defined, 4 => defined, 8 => defined, 10 => defined, ); print "max: " . max(keys %hash) . "\n"; my %kopie = %hash; delete $kopie{max(keys %hash)}; print "zweitmax: " . max(keys %kopie) . "\n";