2008/10/21 six24hourdays <[EMAIL PROTECTED]>: > Hello, > > I would like to know how to test for the last element of a list during > a foreach loop, e.g. > > foreach $element (@List) { > if (this is the last element) { > do something > } > } >
my $i =0; for (@list) { if ($i == $#list) { .... } $i ++; } -- Jeff Pang http://home.arcor.de/pangj/ -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/