Hi yitzle,

The reason to escape @ inside a double-quoted string is to prevent
Perl from treating @example as an array.

#  gives  $id = "user1.com"  since @example is empty
$id = "[EMAIL PROTECTED]";

To prevent this, I believe it's better to use single quotes here

$id = '[EMAIL PROTECTED]';

I agree with you that escaping . isn't necessary. However, unless we
can be sure that the data we read in are properly formatted, escaping
. won't hurt.

m/[EMAIL PROTECTED]/

will match

[EMAIL PROTECTED]
[EMAIL PROTECTED]
[EMAIL PROTECTED]

cheers

Higashi



On 4/20/07, yitzle <[EMAIL PROTECTED]> wrote:
I fail to see the need to escape the @ and .
A . needs to be escaped in RegEx to avoid confusion with the 'match
any character', but otherwise, I don't think you want the slash there.

On 4/20/07, Higashi Noboru <[EMAIL PROTECTED]> wrote:
> try this
>
> $id = "[EMAIL PROTECTED]";
>
> cheers


--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to