Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re: Non-regex Methods of Extracting the Last Field from a Record

by allolex (Curate)
on May 08, 2009 at 17:12 UTC ( #762883=note: print w/ replies, xml ) Need Help??


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


Comment on Re: Non-regex Methods of Extracting the Last Field from a Record
Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://762883]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (8)
As of 2014-10-24 08:45 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    For retirement, I am banking on:










    Results (131 votes), past polls