START blocks provide "do once" capability in Perl 6.
Whoa! I will stop complaining like whatever the common English idiom for a recurring, annoying and insisting whiner is.
Would someone care how it would apply to the original (Perl 5) example?
while ( <FH> ) {
next if $_ eq 'foo'; # Where foo can only appear once in the file
print;
}
| [reply] [Watch: Dir/Any] [d/l] |
That's not a "do once", that's a "test true once". So you'd want something more like a flipflop operator:
next if ($_ eq 'foo') ff False;
Presumably the compiler can recognize that the False test
will never be true.
Those parens bother me though. Maybe the flipflop should be of looser precedence...say, the same precedence as ??!! perhaps... Hmm...
| [reply] [Watch: Dir/Any] [d/l] |