# perl -lwE'for (reverse 0..2) { our $foo; local *foo; $foo=$_ if $_==1; print $foo // "undef"; }' undef 1 undef