in reply to foreach only for a section of a list
I'd be inclined to just iterate over the index:
foreach my $idx ( 0 .. $#somewords - 1 ) { print " $somewords[$idx]\n"; }
The slice technique is also nice though:
foreach my $core ( @somewords[ 0 .. $#somewords - 1 ] ) { print " $core\n"; }
Dave
|
|---|