Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
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


Comment on Re: parsing
Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (6)
As of 2014-12-21 09:38 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (104 votes), past polls