develooper Front page | perl.perl5.porters | Postings from August 2012

Re: fixing smartmatch just hard enough (and when, too)

Thread Previous | Thread Next
From:
Johan Vromans
Date:
August 20, 2012 05:44
Subject:
Re: fixing smartmatch just hard enough (and when, too)
Message ID:
m24nnxka1w.fsf@phoenix.squirrel.nl
Damian Conway <damian@conway.org> writes:

> A simple failure-case I have already mentioned privately to Rick is this:
>
>    while (readline) {
>         when (undef)    { say 'done'; last;  }
>         when (0)        { say 'must be +ve'; }
>         when (any 1..9) { say 'digit';       }
>         default         { die 'horribly';    }
>     }
>
> ...which dies horribly even when a single digit is correctly typed in.

I assume this is because of the trailing newline?
If so, I think it should die. "1" is not equal to "1\n" even though atoi
fans will claim so.

-- Johan

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About