dizou has asked for the wisdom of the Perl Monks concerning the following question:
Hi, I am new to perl. I have a list which I want to go through using foreach, except I don't want the loop to include the last entry of the list. Is there a way I can limit the foreach loop to only a section of the list, or in this case, exclude/exit when it reaches the last one?
foreach $core (@somewords) { print " ${core};\n }
so in the example above, if @somewords = a,b,c,d then I only want the foreach loop to print a,b,c. Thanks.
|
|---|