in reply to Re^2: Why doesn't this work?
in thread Why doesn't this work?

maybe shorter?

DB<178> open $fh,"<",\"1\0 2\0 3" DB<179> print scalar do {local $/="\0"; () = <$fh> } 3

update
as one liner
perl -e '$/="\0"; print $a=()=<>'

Cheers Rolf

( addicted to the Perl Programming Language)

Replies are listed 'Best First'.
Re^4: Why doesn't this work?
by choroba (Cardinal) on Apr 12, 2013 at 22:39 UTC
    Even shorter:
    {local $/="\0"; () = <$fh>; print $.}
    لսႽ† ᥲᥒ⚪⟊Ⴙᘓᖇ Ꮅᘓᖇ⎱ Ⴙᥲ𝇋ƙᘓᖇ