use strict; use warnings; my $foo = 'foo'; bar(); $foo = 'bar'; bar(); sub bar { print "$foo\n"; }