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

Re: Simple line parse question

by nvivek (Vicar)
on Aug 07, 2010 at 04:28 UTC ( #853516=note: print w/replies, xml ) Need Help??


in reply to Simple line parse question

Yeah,you could do with split and join but it needs two functions.Instead, you can use the simple regular expression to achieve it.You check the following code.I have taken the space as a delimiter between each word in the string.

use strict; use warnings; my $string="one two three four five six"; $string=~/^(\w+ ){2}(\w+) (\w+)/; print $2$3; #it prints the words correctly as you expected

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://853516]
help
Chatterbox?
[nysus]: Can anyone else submit a post? I can't. I just see the preview button. No way for me to submit a post.

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (6)
As of 2017-12-15 03:33 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    What programming language do you hate the most?




















    Results (416 votes). Check out past polls.

    Notices?