On Fri, Sep 4, 2009 at 23:06, Noah Garrett Wallach<noah-l...@enabled.com> wrote: > > > Okay I am having troubles finding this. in the perldoc modules. > Is there a slicker way to write the following? > > if ($line =~ /(Blah1)(.*)/) { > $blah = $1 if $1; > $blah2 = $2 if $2; > } snip
In list context a regex will return its captures: my ($blah, $blah2) = $line =~ /(Blah1)(.*)/; -- Chas. Owens wonkden.net The most important skill a programmer can have is the ability to read. -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/