bsorahan has asked for the wisdom of the Perl Monks concerning the following question:
doesn't return binary data read from a filehandle argument. I managed to get this subroutine working by instead doingsub data_for { binmode($_[0]); return <$_[0]>; }
I've skimmed through perlsub perlref and perlfaq5 but can't seem to explain why my first attempt didn't worksub data_for { binmode($_[0]); read( $_[0], my $data, 100_000_000 ); return $data; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: returning binary data from filehandle
by elTriberium (Friar) on Jul 21, 2011 at 21:04 UTC |