use strict; use warnings; #set up a pretend subref inside some other stuff my $bar = {foo => [ sub {print "fishcake"}]}; { no warnings "uninitialized"; # we're going to be a bit naughty in this block ($bar->{potato}->[0] or sub {return undef})->() } # swap this for # ($bar->{foo}->[0] or sub {return undef})->() # and see what happens