in reply to Re: Auto-incrementing strings in for loops
in thread Auto-incrementing strings in for loops
it seems to me that for part 2 you are 'say'ing the for loop and thus $_ will be the constant 1 then 2.Thanks for your thoughts, but the parsing you suggest is not quite right:
That is, say for ... is understood as say($_) for .... The problem is, unfortunately, much sillier than that: for aliases $_, so I wasn't incrementing the variable that I thought I was incrementing!$ perl5.10 -MO=Deparse,-p -E 'say for 1..2' BEGIN { $^H{'feature_say'} = q(1); $^H{'feature_state'} = q(1); $^H{'feature_switch'} = q(1); } ; say($_) foreach (1 .. 2); -e syntax OK
|
|---|