in reply to Re: How we can separate a backref from a digit?
in thread How we can separate a backref from a digit?

It looks good. By the way:
$a=1; print "Match\n" if "aa1" =~ /^(a)\1$a$/; # not match!
After interpolation of variables we get the false backlink \11! To all: should I submit a bug report to perl.org?
Serge

Replies are listed 'Best First'.
Re^3: How we can separate a backref from a digit?
by ikegami (Patriarch) on Mar 18, 2011 at 07:59 UTC
    Not a bug.
      It's an unexpected result.

        Unexpected to you. Variable interpolation happens before the regular expression is parsed and compiled so there is no difference between

        $a=1; print "Match\n" if "aa1" =~ /^(a)\1$a$/; # not match!
        and
        print "Match\n" if "aa1" =~ /^(a)\11$/; # not match!
        or
        $a='\11'; print "Match\n" if "aa1" =~ /^(a)$a$/; # not match!
        If it did not work like this you could not build regular expressions out of parts stored in variables.

        Jenda
        Enoch was right!
        Enjoy the last years of Rome.

        What would you expect '\1'.'1' to give?