$ using parentheses avoids the ambiguity of variable names. In this way:
$foo = 'house';
'housecat' =~ /$foo/;
'cathouse' =~ /cat$foo/;
'housecat' =~ /${foo}cat/;
Also in the link you provided is a definition for $ a and $ b, but you forgot to copy here.
source
share