Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

returning binary data from filehandle

by bsorahan (Initiate)
on Jul 21, 2011 at 17:08 UTC ( [id://915936]=perlquestion: print w/replies, xml ) Need Help??

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

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://915936]
Approved by toolic
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others imbibing at the Monastery: (4)
As of 2024-04-16 22:00 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found