Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

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

by allolex (Curate)
on May 08, 2009 at 17:12 UTC ( [id://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

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others surveying the Monastery: (5)
As of 2024-04-25 11:06 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found