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

Re: Parse a line

by phenom (Chaplain)
on Dec 10, 2004 at 15:02 UTC ( #413867=note: print w/replies, xml ) Need Help??


in reply to Parse a line

I don't think that script applies to your problem. There are likely a thousand ways of doing what you want, but this works:
#!/usr/bin/perl use strict; use warnings; my $line = 'sample/fresh/fresh/0/pineapple'; my @words = split/\//, $line; print $words[-1],$/;
Look at perldoc -f split

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://413867]
help
Chatterbox?
[stevieb]: I inhereted C#, so I had to become familiar with it pretty quickly. I am considering taking a crack at re-writing berrybrew in C++
[stevieb]: I haven't yet done the reserach needed to see if it's possible though
[jrmcc]: Hi Monks

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (5)
As of 2017-02-20 21:24 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Before electricity was invented, what was the Electric Eel called?






    Results (303 votes). Check out past polls.