in reply to Scoping the regex memory variables and where do I go next

Just a few hours ago, merlyn answered my question "Are there other tricks or techniques to get around this problem?" in another thread :

Another way is to stylistically outlaw all uses of $1 et seq, except in the right side of a substitution. Any other "capturing" should be done as list-context assignment:
my ($first, $second) = $source =~ /blah(this)blah(that)blah/;
Then it's very clear what the scope and origination of $first and $second are.


But I'd still like to know: is that 'unique twist' a feature? merlyn?
Thanks!

Rudif

Replies are listed 'Best First'.
Re: Re: Scoping the regex memory variables and where do I go next
by japhy (Canon) on Mar 01, 2001 at 05:20 UTC
    It's a documented feature of m//. Also, the $DIGIT variables are read-only, so storing their values in another variable allows you to modify them.

    japhy -- Perl and Regex Hacker