NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.
All the Perl that's Practical to Extract and Report
Stories, comments, journals, and other submissions on use Perl; are Copyright 1998-2006, their respective owners.
How about using $+ ? (Score:2)
TIMTOWTDI, but you don't have to jump through all those hoops, just to get one definite capture variable for every case. Just take a look at
$+[perl.org] and you'll see it was especially designed for these cases, where you have captures in alternatives and you don't know which alternative matched. So, you can just use your 2 captures regex, and simply get the one you want with$+.But, I think this probably is not such a good idea. You ought to strip the backslashes in those quoted strings that are just there to esc
Re: (Score:1)
Two upsides of using conditional match:
The boolean flag makes it particularly nice to make the backslash stripping conditional on the presence of quotes.