On Sat, May 07, 2005 at 04:13:12PM -0700, amr wrote: > How can I call the last element in the array? > > I try the pop and it does the job but I think there is another way? > If my @a = (1, 2, 3, 4); then:
my $last = pop @a; is the same as my $last = $a[-1]; and pop @a; my $third = pop @a; is the same as my $third = $a[-2]; The negative sign in front of N means go N positions towards the start of the array from the end. Peter -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>