Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
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 cooling their heels in the Monastery: (6)
As of 2015-07-07 01:26 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (86 votes), past polls