Prev: while() doesn't localize $_ but for() does in some situations. Is this expected?
Next: FAQ 9.10 How do I decode or create those %-encodings on the web?
From: Willem on 14 Jul 2010 09:42 Matthew Horsfall wrote: ) It seems that while() loops don't localize $_ in certain situations, ) whereas for loops do. For loops don't *localize* $_ either. What they do is *alias* $_ to whatever they're looping on. Try: sub foo { print } for (<STDIN>) { foo } As opposed to: sub foo { print } my $_; for (<STDIN>) { foo } ) Is this expected behavior? Yes. for() aliases whereas while() assigns. SaSW, Willem -- Disclaimer: I am in no way responsible for any of the statements made in the above text. For all I know I might be drugged or something.. No I'm not paranoid. You all think I'm paranoid, don't you ! #EOT |