[Israel.pm] Fwd: [Telux] Next Meeting: "High-Level Programming Concepts Using Perl 6" on 22-March

Offer Kaye offer.kaye at gmail.com
Sun Mar 15 02:42:12 PDT 2009


On Sun, Mar 15, 2009 at 12:33 AM, Mikhael Goikhman wrote:
>
> /.../ evaluates regular expression, and qr/.../ operator returns
> something between a regular string and an object. Read "perldoc perlop"
> under Regexp Quote-Like Operators section.
>

To be precise (well pedantic tbh :)), both the "m/.../" and the
"qr/.../" are operators.

However as Michael wrote, they do very different things - m/.../
actually runs Perl's RE engine, evaluating the regexp. Even without
the binding operator, the regexp inside the operator will be
interpreted.

In contrast, all qr/.../ does(*) is quote the regexp - not much
differently from using double-quotes or the qq/.../ operator - and
return the quoted form. This "quoted form" will be evaluated when you
actually use it in matching or substitution operation.

(*) "It magically differs from a string containing the same
characters" to quote the documentation.

Cheers,
-- 
Offer Kaye



More information about the Perl mailing list