in reply to foreach only for a section of a list
Another way, with pop and push:
my $last = pop @somewords; foreach my $core (@somewords) { print " $core;\n" } push @somewords,$last;
Update: it's useless to keep $last. See the improvement by johngg, in reply.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: foreach only for a section of a list
by johngg (Canon) on May 05, 2012 at 12:13 UTC |