in reply to
Difference between $1 and \1.
Checking the perl documentation, one could get glorious insight.
perldoc -v $1 Update I: OR check perlvar
from the CLI gives:
$<*digits*> ($1, $2, ...):
Contains the subpattern from the corresponding set of capturing
parentheses from the last successful pattern match, not counting
patterns matched in nested blocks that have been exited already.
These variables are read-only and dynamically-scoped.
While \1 :
is Backreference to a specific capture group or buffer. Please also check perlre.
It is also a good thing to note this Warning on \1 Instead of $1
UPDATE I: I was only checking this on Win OS. Thanks to LanX comments below.
If you tell me, I'll forget.
If you show me, I'll remember.
if you involve me, I'll understand.
--- Author unknown to me