$ man perlre Starting in Perl 5.14, a "^" (caret or circumflex accent) immediately after the "?" is a shorthand equivalent to "d-imnsx". Any positive flags (except "d") may follow the caret, so (?^x:foo) is equivalent to (?x-imns:foo) The caret tells Perl that this cluster doesn't inherit the flags of any surrounding pattern, but uses the system defaults ("d-imnsx"), modified by any flags specified.