$ perl -e " use strict; use warnings; if( 0 ){ my $foo = 1; } else { $foo = 2; } " Global symbol "$foo" requires explicit package name at -e line 1. Execution of -e aborted due to compilation errors. $ perl -e " use strict; use warnings; if( 1 ){ my $foo = 1; } else { $foo = 2; } " Global symbol "$foo" requires explicit package name at -e line 1. Execution of -e aborted due to compilation errors.