in reply to Printing regular expression variable

G'day MattLG,

qr{...} does not return a string! See perlop - Regexp Quote-Like Operators for a description of what it does return. Here's an example:

$ perl -Mstrict -Mwarnings -E ' say q{*** Using qr{}}; my $re = qr{^.*$}; say ref $re; say $re; say q{*** Using q{}}; my $str = q{^.*$}; say ref $str; say $str; ' *** Using qr{} Regexp (?^u:^.*$) *** Using q{} ^.*$

Related documentation:

-- Ken

Replies are listed 'Best First'.
Re^2: Printing regular expression variable
by MattLG (Beadle) on May 28, 2013 at 13:32 UTC
    ....qr{...} does not return a string!

    Yes, I'm aware of that, otherwise it wouldn't work.

    MattLG