Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re: split every second word

by jweed (Chaplain)
on Dec 04, 2003 at 15:43 UTC ( [id://312224]=note: print w/replies, xml ) Need Help??


in reply to split every second word

Well, I'm not entirely sure about the nature of your text. If it is in a file, one name to each line like you say it is (well you say that they basically are):

Bob Builder Tinky Winky etc.
then you can simply open the file and read it into an array like this:
my @names = <FH>

If they are all on one line like your example, it is a bit trickier. But, since this seems like it might be a homework problem, I'll have you figure it out.

Update Well, I guess I misread your original post. You left out the to in got to put them on separate lines. Don't mind me.


Who is Kayser Söze?

Log In?
Username:
Password:

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

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

      No recent polls found