The scalar range operator, or flip-flop, is handy for constructs like this:
That makes the decision to print be carried by the state of the range operator. A simpler loop results.my @arr = qw( bar qux foo qux2 bar2 foo foo3 ); my $marker = "foo"; for (@arr) { print $_, $/ if ($marker eq $_) .. 1; } __END__ foo qux2 bar2 foo foo3
After Compline,
Zaxo
In reply to Re: Construct for Skipping and Continue
by Zaxo
in thread Construct for Skipping and Continue
by monkfan
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |