http://www.perlmonks.org?node_id=762883


in reply to Non-regex Methods of Extracting the Last Field from a Record

so I was looking for a simpler, array-manipulation method of extracting the last item from a variable length array.

This made me think of pop() as yet another approach to getting the right field from the array.

my $rec = 'a b c d e f 96'; my @a = split /\s+/, $rec; printf "ads = %s\n", pop @a;

--
Damon Allen Davison
http://www.allolex.net