Re: perl experts - \1 better written as $1 ?

2010-06-10 Thread Bowie Bailey
Per Jessen wrote: > I have a bit of SA code where I strip leading and trailing whitespace - > > foreach (@addrs) { s/^\s*([^\s]+)\s*$/\1/; } > > Whenever I run this I get the warning "\1 better written as $1" which I > understand to be perl telling me that the right side of s/// should use > $digi

Re: perl experts - \1 better written as $1 ?

2010-06-10 Thread Per Jessen
Mark Martinec wrote: > 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 Yeah I know, but I'm quietly ignoring that possibility. I haven't seen one the last four-five

Re: perl experts - \1 better written as $1 ?

2010-06-10 Thread Mark Martinec
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

Re: perl experts - \1 better written as $1 ?

2010-06-10 Thread Per Jessen
Karsten Bräckelmann wrote: > On Thu, 2010-06-10 at 12:08 +0200, Per Jessen wrote: >> > > I have a bit of SA code where I strip leading and trailing >> > > whitespace >> > > >> > > foreach (@addrs) { s/^\s*([^\s]+)\s*$/\1/; } >> > > >> > > Whenever I run this I get the warning "\1 better writte

Re: perl experts - \1 better written as $1 ?

2010-06-10 Thread Karsten Bräckelmann
On Thu, 2010-06-10 at 12:08 +0200, Per Jessen wrote: > > > I have a bit of SA code where I strip leading and trailing whitespace > > > > > > foreach (@addrs) { s/^\s*([^\s]+)\s*$/\1/; } > > > > > > Whenever I run this I get the warning "\1 better written as $1" which > > > I understand to be pe

Re: perl experts - \1 better written as $1 ?

2010-06-10 Thread Per Jessen
Mark Martinec wrote: > Per, > >> I have a bit of SA code where I strip leading and trailing whitespace >> - >> foreach (@addrs) { s/^\s*([^\s]+)\s*$/\1/; } >> Whenever I run this I get the warning "\1 better written as $1" which >> I understand to be perl telling me that the right side of s///

Re: perl experts - \1 better written as $1 ?

2010-06-10 Thread Mark Martinec
Per, > I have a bit of SA code where I strip leading and trailing whitespace - > foreach (@addrs) { s/^\s*([^\s]+)\s*$/\1/; } > Whenever I run this I get the warning "\1 better written as $1" which I > understand to be perl telling me that the right side of s/// should use > $digit, not \digit.

Re: perl experts - \1 better written as $1 ?

2010-06-10 Thread Stefan Hornburg (Racke)
On 06/10/2010 08:36 AM, Per Jessen wrote: I have a bit of SA code where I strip leading and trailing whitespace - foreach (@addrs) { s/^\s*([^\s]+)\s*$/\1/; } Whenever I run this I get the warning "\1 better written as $1" which I understand to be perl telling me that the right side of s/// sho

perl experts - \1 better written as $1 ?

2010-06-09 Thread Per Jessen
I have a bit of SA code where I strip leading and trailing whitespace - foreach (@addrs) { s/^\s*([^\s]+)\s*$/\1/; } Whenever I run this I get the warning "\1 better written as $1" which I understand to be perl telling me that the right side of s/// should use $digit, not \digit. I tried changi