spamassassin-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mark Martinec <Mark.Martinec...@ijs.si>
Subject Re: perl experts - \1 better written as $1 ?
Date Thu, 10 Jun 2010 12:32:30 GMT
Per,

> >> There are no spaces in the string, it's an email address.

An email address can legitimately contain a space, see RFC 2822,
e.g.
  "some x user"@example.com
 
> >> I did try using $1 on the right side of the s///, but it didn't work.

Most weird. Which version of perl?

Try this:

$ perl -le '@a=@ARGV; s/^\s*(.*?)\s*$/$1/ for @a; print "/$_/" for @a' \
"x " " y" " z z "

should produce:
/x/
/y/
/z z/


> Well, as the \1 variation worked apart from the warning, I didn't bother
> with going any further.  I have a feeling the $1 might be getting
> substituted first?  so maybe I should escape it?  Anyway, thanks for
> your suggestion, it's much better.

No escaping, the $1 should work as show.

  Mark

Mime
View raw message