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
In reply to Re: first two words-pattern matching
by saskaqueer
in thread first two words-pattern matching
by shamala
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |