D. Bolliger wrote:
Gallagher, Tim F (NE) am Donnerstag, 14. Dezember 2006 15:29:
Lets say that I have a list of data that have a few things in common, ie

this is a 1 test to see 2 what is happening 3 to the state of the 4
country
all work 1 and no 2 play makes 3 jack a dull boy 4
how 1 much wood 2 could a wood 3 chuck 4 chuck

so I want to grab all data between 1 - 2 and 3 - 4  2 different
variables, can this be done?

Yes :-)

Use capturing parenthesis for that, see perldoc perlre

Dani


($var1, $var2) = $str =~ /1(.*?)2.*?3(.*?)4/;

--
BR
Eugene Kosov

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to