use strict; $SIG{__WARN__} = \&mywarn; sub mywarn { print "here!\n @_\n"; } { test ('arf', undef, 'dog'); } sub test { @_ == 3 or die "Incorrect number of arguments"; my ($a, $b, $c) = @_; my %hash = ('arf' => {'spot' => {'dog' => 3}}); print $hash {$a}->{$b}->{$c}; }