- or download this
foreach (qw/foo bar/) {
print;
print foreach (qw/one two three/);
}
# output: fooonetwothreebaronetwothree
- or download this
foreach (qw/foo bar/) {
print;
...
print while (shift @list);
}
# output: foofoofoofoobarbarbarbar
- or download this
foreach (qw/foo bar/) {
print;
...
print while (local $_ = shift @list);
}
# output: fooonetwothreebaronetwothree
- or download this
{ local $_; print while (shift @list); }
- or download this
# will not localize $_ to the while loop
local $_; print while (shift @list);