The following SSCCE uses the "qr" operator to quote a string as a regular expression. The non-capturing part of the regex curiously has a "caret" inserted between the question mark and the colon. I've looked and can find no explanation or example of what the "caret" does in the regex produced by "qr". The "caret" does NOT (thankfully) anchor the regex at the beginning of the line, so what does it do?
#!/usr/bin/perl use strict; use warnings; my $text = 'abcd'; my $regex = qr/$text/; print "\n\$text = |$text| \$regex = |$regex|\n\n"; __END__ Output: $text = |abcd| $regex = |(?^:abcd)|
"It's not how hard you work, it's how much you get done."
In reply to Purpose of the "caret" character in "qr" regex output by roho
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |