in reply to Avoid using local $/=undef?

I soon noticed that it was using local $/=undef. Which I gathered is generally frowned upon.
Eh? That's news to me.

Anyway, I see you're trying to read 64 bytes at a time, so you might think of setting $/ to a ref to a scalar containing the value 64. This will work:

local $/ = \64;
as will
my $length = 64; local $/ = \$length;

After that, you can just read from the file with <HANDLE>, but I recommend calling binmode on the handle first, unless, maybe, you're absolutely sure you will only ever run this on Unix-like systems.

But I'd still do it anyway.

Replies are listed 'Best First'.
Re^2: Avoid using local $/=undef?
by cdarke (Prior) on Nov 13, 2009 at 08:58 UTC
    Problem with setting local $/ = \64 is that it is easy to forget the \ (which at least one monk has done in the past).

    read might be a better bet.