You are right, when used in a regex without an /m modifier, ^ means “match the beginning of the string,” and is equivalent to \A. “Match at the beginning of the line” (which is the definition given in perlre#Regular-Expressions) is strictly correct only when ^ is used in a regex with an /m modifier. So maybe this part of the documentation should be re-worded?
I haven’t used Perl::Critic, and as to this particular policy — well, I’m suspicious of guidelines that say “always do X” regardless of context. In the present case, adding an /m modifier to the regex would, IMO, be misleading, as it would imply (or at least suggest) that the string being matched is expected to contain multiple newlines. But I acknowledge that this is a judgment call, and YMMV.
| Athanasius <°(((>< contra mundum | Iustus alius egestas vitae, eros Piratica, |
In reply to Re^5: reg expression question
by Athanasius
in thread reg expression question
by healingtao
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |