in reply to Unable to find a pattern
Re GrandFather's ( ++ )
my $find = qr'license @abc';versus
my $find = qr/license \@abc/;see perldoc perlop at " Quote and Quote-like Operators" re the quoting ( ww added notes marked by "<!--"):
While we usually think of quotes as literal values, in Perl they function as operators, providing various kinds of interpolating and pattern matching capabilities. Perl provides customary quote characters for these behaviors, but also provides a way for you to choose your quote character for any of them. In the following table, a "{}" represents any pair of delimiters you choose.
Customary Generic Meaning Interpolates
'' q{} Literal no
"" qq{} Literal yes
`` qx{} Command yes*
qw{} Word list no
// m{} Pattern match yes*
qr{} Pattern yes* <!-- backslash is required
if using /.../
s{}{} Substitution yes*
....
* unless the delimiter is ''. <!-- NB!
In other words, if you chose to use my $find = qr/license \@abc/;, the escaping backwhack is required (as massa advised AND as you would have learned had you used the strictures recommended above).
|
|---|