On 20 August 2012 14:44, Johan Vromans <jvromans@squirrel.nl> wrote: > 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. But perl considers "1" numerically equvalent to "1\n", and as far as I can tell without warning either: $ perl -wle'print 1 if "1" == "1\n"' 1 and actually, the only thing I find weird here is that it *doesn't* warn. -- perl -Mre=debug -e "/just|another|perl|hacker/"Thread Previous | Thread Next