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.
In reply to Re: foreach only for a section of a list
by brx
in thread foreach only for a section of a list
by dizou
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |