Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re: first two words-pattern matching

by saskaqueer (Friar)
on May 12, 2004 at 06:18 UTC ( [id://352653]=note: print w/replies, xml ) Need Help??


in reply to first two words-pattern matching

while (<DATA>) { # We could use split( /\s+/, $_, 3 ) to explicitly # set the max split limit to 3, but split() is smart # enough to see we are capturing into 2 variables and # automatically sets the limit to 3. Smart perl! my ($first, $second) = split( /\s+/ ); print "Line $.: '$first $second'\n"; } __DATA__ this is the first line right here line two comes next way down here then third line is here fourth comes next

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others studying the Monastery: (5)
As of 2024-04-24 23:20 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found