in reply to Re: On patterns and more
in thread On patterns and more

Not at all. It relates to the match, substitution and tr operators, not regular expressions. Some of those operators take a regular expression for argument, but that's unrelated to «=~».


«=~» is the means by which one specifies the operand (argument) for some operators.

$x =~ m/.../ # Matches against $x $x =~ s/.../.../ # Modifies $x $x =~ tr/.../.../ # Modifies $x

«/.../» is short for «m/.../».

Operators that support «=~» default to using «$_» if «=~» isn't' used. For example, «/.../» is short for «$_ =~ /.../».

The match operator is implied if the RHS of «=~» is an expression, so «$x =~ "pat"» means «$x =~ /pat/» and «$x =~ $pat» means «$x =~ /$pat/».