my $city; # now is scoped to the whole package! foreach $city ( @myCities ) { # do your stuff } print "$city"; # works as expected!