# foo.pl use strict; use warnings; require 'bar.pl'; frobozz( 2 ); __END__ # bar.pl use strict; use warnings; { my $x; # same thing with "my $x = 'whatever';" frobozz( 1 ) unless caller; sub frobozz { ( $x ) = @_; print 'NOT ' unless defined eval( '$x' ); print "OK\n"; quux(); } sub quux { # $x = $x; print 'NOT ' unless defined eval( '$x' ); print "OK\n"; } } 1; __END__