$ 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