What is @

A

asdf

Hi,

I have a perl script for filtering spam. Did not write it, don't
know perl. The white list and black list files it looks to are just
lists of email addresses. I have been told since perl 5 came out I should
escape all @ with a \. What if I don't? Is is just another form of
wildcard? The chances of something other than the intended email
address having the same start and ending seems remote.

(e-mail address removed)
vic\@some.com

Thanks,

Vic
 
S

Shawn Corey

asdf said:
Hi,

I have a perl script for filtering spam. Did not write it, don't
know perl. The white list and black list files it looks to are just
lists of email addresses. I have been told since perl 5 came out I should
escape all @ with a \. What if I don't? Is is just another form of
wildcard? The chances of something other than the intended email
address having the same start and ending seems remote.

(e-mail address removed)
vic\@some.com

Thanks,

Vic

"... seems remote" is the operative phrase. It is possible for the
improbable to happen.

You should escape the '@' if it appears in a double-quoted Perl string.
If the addresses are in a data file, leave them alone. Perl knows not to
touch them. However, if you see something like these in a Perl program,
escape the '@':

print "me\@my.domain.com";
my $my_address = qq(me\@my.domain.com);

These you leave alone:

print '(e-mail address removed)';
print q/[email protected]/;
my @my_addresses = qw( (e-mail address removed) );

See perldoc perlop as to why.

--- Shawn
 
A

asdf

I will escape it. I looked at the script and cannot figure it out.
Should only take, I don't know how long to edit the file.

Thanks,

Vic
 
J

Jürgen Exner

asdf said:
I have a perl script for filtering spam. Did not write it, don't
know perl. The white list and black list files it looks to are just
lists of email addresses. I have been told since perl 5 came out I
should escape all @ with a \.

That is BS.
What if I don't? Is is just another
form of wildcard?

It has nothing to do with wildcards whatsoever.
The @ is the syntactic indicator for an array, just like the $ indicates a
scalar and the % a hash.
The chances of something other than the intended
email address having the same start and ending seems remote.

(e-mail address removed)
vic\@some.com

If you don't want to refer to the array @some but to the literal text
'@some' _AND_THIS_TEXT_IS_IN_A_DOUBLE_QUOTED_STRING_ then you need to escape
the and at sign, otherwise not. If you escape it randomly, then chances are
that the code doesn't work any longer because perl will not be able to
recognize an array any more.

jue
 
T

Tad McClellan

asdf said:
I will escape it.


Why?

All of the advice to this point has been to leave the data alone!

I looked at the script and cannot figure it out.


Here is a test to try:

Is it working without backslashing at-signs?

If so, then leave the data alone.

If not, then try backslashing at-signs.

ie. do not "fix it" if it is not "broken".

Should only take, I don't know how long


About 10 seconds...

to edit the file.

.... if you use Perl to do it for you (untested):

perl -p -i.noslash -e 's/\@/\\@/g' data_file
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,776
Messages
2,569,602
Members
45,182
Latest member
BettinaPol

Latest Threads

Top