my $ref = eval { defined($asset->{related_files}) ? decode_json($asset->{related_files}) : []; }; #### print "Exists\n" if exists $hash{$key}; print "Defined\n" if defined $hash{$key}; print "True\n" if $hash{$key}; #### $ perl -Mstrict -Mwarnings -E 'my $x; eval { my $y = defined $x ? 1 : 0; }; say $@ if $@; say $y;' Global symbol "$y" requires explicit package name at -e line 1. Execution of -e aborted due to compilation errors. $ perl -Mstrict -Mwarnings -E 'my $x; my $y = eval { defined $x ? 1 : 0; }; say $@ if $@; say $y;' 0