A do { ... } unless { ...; } variant.
$ perl -Mstrict -Mwarnings -E ' my $raLines = [ qw{ Line1 Line2 Line3 } ]; sayLines( $raLines, q{ } ); sub sayLines { my( $raLines, $indent ) = @_; my $notFirst; do { print $indent; $notFirst ++; } unless $notFirst; say for @{ $raLines }; }' Line1 Line2 Line3 $
Cheers,
JohnGG
In reply to Re: Easiest way to do something only on first iteration of loop
by johngg
in thread Easiest way to do something only on first iteration of loop
by ibm1620
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |