http://www.perlmonks.org?node_id=990471


in reply to undef is undef

this works, but it's not pretty:

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 t +his block ($bar->{potato}->[0] or sub {return undef})->() } # swap this for # ($bar->{foo}->[0] or sub {return undef})->() # and see what happens

if you use that then if I were you I'd comment it liberally, and possibly surround it with bio-hazard marker tape.