[sf-perl] amusing bug

Fred Moyer fred at redhotpenguin.com
Tue May 4 11:43:02 PDT 2010


On Tue, May 4, 2010 at 11:32 AM, David Alban <extasia at extasia.org> wrote:
> it's so easy to miss the error in:
>
>     $line =~ s{ s+ \z }{}xms;

Yep, I didn't catch this immediately.  One of the reasons I tend to
default to using / delimiters, and only the regex flags I need.  I
think this invocation makes it easier to catch the missing \

       $line =~ s/s+\z/;

       $line =~ s/\s+\z/;

>
> 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
>
> --
> Live in a world of your own, but always welcome visitors.
> _______________________________________________
> SanFrancisco-pm mailing list
> SanFrancisco-pm at pm.org
> http://mail.pm.org/mailman/listinfo/sanfrancisco-pm
>


More information about the SanFrancisco-pm mailing list