>>>>> "sw" == shawn wilson <ag4ve...@gmail.com> writes:

  sw> On Jun 3, 2011 3:17 PM, "Uri Guttman" <u...@stemsystems.com> wrote:
  >> 

  >> 
  >> perl -le 'my $x = "zzz" ; for $x ( qw( foo bar ) ) { print "L: $x" } print
  sw> "E: $x"'
  >> L: foo
  >> L: bar
  >> E: zzz

  sw> That's odd, I would have thought that would have given 'foo bar bar'. So,
  sw> how would you keep data from a loop once you're outside of the loop?

you don't use a loop variable for that. just declare it before the loop,
assign as needed inside the loop and it will be there. if that gets
messy as it can, i change the code to use a sub with the loop inside and
return the value. 

uri

-- 
Uri Guttman  ------  u...@stemsystems.com  --------  http://www.sysarch.com --
-----  Perl Code Review , Architecture, Development, Training, Support ------
---------  Gourmet Hot Cocoa Mix  ----  http://bestfriendscocoa.com ---------

-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to