http://www.perlmonks.org?node_id=1223397


in reply to Re^2: truth in while condition
in thread truth in while condition

(solved, see update)

> (It could also happen when $/ = \1; )

This splits on single characters, including \n.

But I couldn't find this behavior documented, neither in perlvar#$INPUT_RECORD_SEPARATOR nor readline

use strict; use warnings; use feature 'say'; $/ = \1; while ( $_= <DATA>) { say "<$_>"; } __DATA__ 1 0 345

--->

<1> < > <0> < > <3> <4> <5> < >

update

oops I misread \1 as "\1" (ASCII 01), but it's a ref to literal 1, so this from perlvar applies:

> Setting $/ to a reference to an integer, scalar containing an integer, or scalar that's convertible to an integer will attempt to read records instead of lines, with the maximum record size being the referenced integer number of characters.

Cheers Rolf
(addicted to the Perl Programming Language :)
Wikisyntax for the Monastery FootballPerl is like chess, only without the dice