Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re: Printing regular expression variable

by kcott (Archbishop)
on May 28, 2013 at 01:27 UTC ( [id://1035495]=note: print w/replies, xml ) Need Help??


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 (Sexton) 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

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1035495]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others taking refuge in the Monastery: (3)
As of 2024-04-24 02:11 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found