This does not match 'aa'. It matched only 'a'. When i replaced with \1 , i got the output .$str = aa; $str =~ /(a)$1/; print "$&";
Can anyone explain this behaviour ?$str = aa; $str =~ /(a)\1/; print "$&";
In reply to Difference between $1 and \1. by rbala
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |