On Tue, Feb 28, 2006 at 11:37:46AM -0800, Loren Wilton wrote:
> I'm not absolutely sure what @name in a regex really means to perl, but it
> seems to not be what I usually expect.  Escaping the @ ends up producing the
> right results.

@name means the array "name".  Perl isn't sure whether or not you want
to expand the array for use in the RE, so you need to escape it so that
perl has no question about what you're trying to do.  By default, the
array is expanded.  This is the same reason you need to escape dollar
signs, since $name is the scalar variable "name".  ie:

$ perl -e '@t=(1,2,3); $t=qr/@t/; print "$t\n"'
(?-xism:1 2 3)

versus

$ perl -e '@t=(1,2,3); $t=qr/[EMAIL PROTECTED]/; print "$t\n"'
(?-xism:[EMAIL PROTECTED])


:)

-- 
Randomly Generated Tagline:
 "I don't get it. Who was this Ted Danson, and why would you pay $10,000 for
 his skeleton?" -Leela 

Attachment: pgpxD2953kKBT.pgp
Description: PGP signature

Reply via email to