Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Re: parsing

by bjelli (Pilgrim)
on Jul 11, 2002 at 14:45 UTC ( #181033=note: print w/replies, xml ) Need Help??


in reply to parsing

After your loop the last line read is still in $_, so you can use

@path = split(/\//, $_); $importantdir = $path[-3];

the negative index in the array counts from the end of the array rather than the beginning.

--
Brigitte    'I never met a chocolate I didnt like'    Jellinek
http://www.horus.com/~bjelli/         http://perlwelt.horus.at

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://181033]
help
Chatterbox?
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (10)
As of 2016-12-09 14:47 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    On a regular basis, I'm most likely to spy upon:













    Results (152 votes). Check out past polls.