On Sun, 18 Jan 2015 11:49:11 -0500 Mike <ekimduna...@gmail.com> wrote:
> Hey everyone, I'm trying to find information on how I can use regular > expressions to populate a variable. > > I want to pull text between one set of characters and another set of > characters and use that to populate my variable. Can anyone point me > in the right direction? > > Thanks. > Use parentheses to select the part of the match you want in your variables: my ( $var1, $var2, @rest ) =~ /some characters(populates $var1)more characters(populates $var2) more (populates @rest) more (populates @rest) /; See `perdoc perlre` and search for /Capture groups/ http://perldoc.perl.org/perlre.html#Capture-groups For more info: perldoc perlretut http://perldoc.perl.org/perlretut.html perldoc perlrequick http://perldoc.perl.org/perlrequick.html perldoc perlre http://perldoc.perl.org/perlre.html -- Don't stop where the ink does. Shawn -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/