Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re: split and join

by Anonymous Monk
on Jan 04, 2002 at 03:52 UTC ( #136150=note: print w/ replies, xml ) Need Help??


in reply to split and join

just wondering if u had

$line="Bart Lisa Maggie Marge Homer blah blah"; @simpsons=split(/\s+/, $line);

what i wanted is to split so as to get

@simpsons = {"Bart", "Lisa", "Maggie", "Marge", "Homer blah blah"}

notice the last part i want it all attached. Assume i dont know how many "blah"s follow after "Homer".

Edit: g0n - code tags & formatting


Comment on Re: split and join
Select or Download Code
Re: Re: split and join
by Anonymous Monk on Sep 25, 2002 at 02:28 UTC
    Simple. Use a counter to find the numbers of the Caps in the string and then do..while op until you reach that number.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (5)
As of 2014-07-30 23:31 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (241 votes), past polls