Welcome to the Monastery | |
PerlMonks |
Re: Scoping of my with foreach loopby Popcorn Dave (Abbot) |
on Mar 07, 2005 at 19:17 UTC ( [id://437290]=note: print w/replies, xml ) | Need Help?? |
Other than it won't compile? You need to make that $item.
And yes you could concievably run in to scoping issues. Someone else will correct me if I'm incorrect about this but I believe that if for example, you declare my $item at the top of your program, then it's got global scope. However if that foreach loop was placed in a subroutine then it's going to be local to that routine and you wouldn't have access to it outside the loop.
Update:Fletch picked up what I failed to take in to account completely about being visible within the foreach loop.
Useless trivia: In the 2004 Las Vegas phone book there are approximately 28 pages of ads for massage, but almost 200 for lawyers.
In Section
Seekers of Perl Wisdom
|
|