#use strict; use warnings; sub bar { print $foo; } my $foo = 1; foo(); bar(); sub foo { print $foo; }