in reply to Re: Matching patterns containing a caret
in thread Matching patterns containing a caret

$p = $s = "\^xxx";

You probably meant

$s = "^xxx"; $p = '\^xxx'; # or "\\^xxx" ...

(a backslash in a double-quoted string just escapes the next char...)

Replies are listed 'Best First'.
Re^3: Matching patterns containing a caret
by chromatic (Archbishop) on Apr 26, 2009 at 23:03 UTC

    Why worry about quoting constructs? qr// has worked very well for ages:

    my $p = qr/\^xxx/;