[ale] perl question
Derek Atkins
warlord at MIT.EDU
Tue Jan 17 11:22:39 EST 2012
Geoffrey Myers <lists at serioustechnology.com> writes:
> Oh the loop works as defined, it's just that the value is not passed to
> the sub bar() My expectation was that since the call to bar() was
> inside the loop, that $foo would be accessible within the sub.
Alas, it doesn't work that way. PERL doesn't scope variables that way.
You would need to define a global and assign it, or you would need to
pass it as a variable to the sub.
-derek
--
Derek Atkins, SB '93 MIT EE, SM '95 MIT Media Laboratory
Member, MIT Student Information Processing Board (SIPB)
URL: http://web.mit.edu/warlord/ PP-ASEL-IA N1NWH
warlord at MIT.EDU PGP key available
More information about the Ale
mailing list