[sf-perl] amusing bug
David Fetter
david at fetter.org
Tue May 4 11:39:29 PDT 2010
On Tue, May 04, 2010 at 11:32:36AM -0700, David Alban wrote:
> it's so easy to miss the error in:
>
> $line =~ s{ s+ \z }{}xms;
>
> when you expect to see:
>
> $line =~ s{ \s+ \z }{}xms;
>
> i wondered why one of the lines was having its last character stripped
> but the others were ok.
>
> /me goes to get more caffiene
This is why I use multi-line regexes for even the most trivial-seeming
things :)
Cheers,
David (who could well have missed the difference between s and \s, but
likes to think he'd have had a slightly easier time debugging same
than with the one-liner)
--
David Fetter <david at fetter.org> http://fetter.org/
Phone: +1 415 235 3778 AIM: dfetter666 Yahoo!: dfetter
Skype: davidfetter XMPP: david.fetter at gmail.com
iCal: webcal://www.tripit.com/feed/ical/people/david74/tripit.ics
Remember to vote!
Consider donating to Postgres: http://www.postgresql.org/about/donate
More information about the SanFrancisco-pm
mailing list