Paul Lalli schreef:
> Ryan:
>> I thought the * character needed a backslash to be taken literally.
>> But I guess that's only in regular expressions? I was confused
>> about that.
>
> Correct. * is not special in a double quoted string. The only
> character[s] that always need to be backslashed in a double-quoted
string
> are:
> $ (otherwise, it's the start of a scalar variable, array element, or
> hash element)
> @ (otherwise, it's the start of an array or slice)
An unescaped @ can be safe, like in "@", [EMAIL PROTECTED], [EMAIL PROTECTED],
etc.
So the @ should not be followed by word characters or plus or minus or,
inside qq{}, any of the delimiters.
But better safe than sorry, so yes, it's best to always escape the @
inside a double quoted string.
See `perldoc perlop` about qq() and qx() and qx'' and `` and <<.
See `perldoc perlre` too, because the pattern in any regex, and also the
RHS (right hand side) of a substitution (s///) are also double quoted
strings.
> \ (otherwise, it's the indication that the next character is to be
> escaped)
>
> Characters that *sometimes* need to be backslashed in a double quoted
> string include:
> " (if and only if you're actually using " as your string delimiter)
> ' (if it is both preceded by an interpolated variable, and followed by
> word characters)
> : (if it is both preceded by an interpolated variable, and followed by
> a second :, and then word characters)
> Whatever delimiter you're using if you use the qq{} operator.
Fine. A "bad" example of what qq() can cope with:
perl -wle'print qq{a{b}c}'
a{b}c
--
Affijn, Ruud
"Gewoon is een tijger."
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/