bsorahan has asked for the wisdom of the Perl Monks concerning the following question:

I'm having trouble figuring out why
sub data_for { binmode($_[0]); return <$_[0]>; }
doesn't return binary data read from a filehandle argument. I managed to get this subroutine working by instead doing
sub data_for { binmode($_[0]); read( $_[0], my $data, 100_000_000 ); return $data; }
I've skimmed through perlsub perlref and perlfaq5 but can't seem to explain why my first attempt didn't work

Replies are listed 'Best First'.
Re: returning binary data from filehandle
by elTriberium (Friar) on Jul 21, 2011 at 21:04 UTC