my @myCities = (1 .. 2); my $city = "before"; # now is scoped to the whole package! foreach $city ( @myCities ) { # do your stuff $city = "after"; } print "$city"; # works as expected! # ... unless you expected it to print "after" # ... actually it prints "before"