in reply to Re^2: diamond operator multiple input
in thread diamond operator multiple input
I could get rid of that with an extra set of parens, but then there were scoping issues, because the two variables were limited to the scope of the "for" loop:$ perl -e 'use strict; for my ($d,$v){ $_=lc<>; chomp; } print "got $d and $v\n"' Missing $ on loop variable at -e line 1.
Interestingly, neither of those problems seems to affect GrandFather's snippet -- the following not only compiles, but when you feed it data, it does what it's supposed to do:$ perl -e 'use strict; for (my($d,$v)){ $_=lc<>; chomp; } print "got $d and $v\n"' Global symbol "$d" requires explicit package name at -e line 2. Global symbol "$v" requires explicit package name at -e line 2. Execution of -e aborted due to compilation errors.
Again, I'm only looking at 5.8.8 -- it would be good to know whether 5.10 has different behavior in this regard.$ perl -e 'use strict; ($_=lc <>), chomp for my ($d,$v); print "got $d and $v\n"'
|
|---|