You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Are they all the same in the context of smart matching (~~) ?
Yes, except that you can only specify matching adverbs using the m... variant.
This language doc shows that m/thing/ is matched immediately against $_.
All three variants will immediately match if used with smart matching (~~) as you suspected but also if used in sink context, i.e. on their own as a statement:
/.../; # matches immediately
rx/.../; # so does this
m/.../; # and this too
The other two are just regex objects. Perhaps they're better used when saving the regex in a variable?
That sort of thing, yes:
my $regex = /.../; # puts a regex object (`/.../`) in `$var`.
my $match = m/.../; # evaluates the regex within the `m/.../` and puts the resulting match object in `$match`
http://perl6intro.com/#_regex_definition
Explain the differences between
Are they all the same in the context of smart matching (
~~
) ?This language doc shows that
m/thing/
is matched immediately against$_
.The other two are just regex objects. Perhaps they're better used when saving the regex in a variable?
The text was updated successfully, but these errors were encountered: