in reply to Re^4: Error binmode() on unopened filehandle
in thread Error binmode() on unopened filehandle
Find some .jpg file you have somewhere and try the code that I posted. Use of the DATA file handle is "special".
Your initial premise that you could read binary data from the DATA file handle is wrong. That data will be in a character format.
Update: Here is a Perl program that reads and prints itself. DATA is an already read and opened file handle.
use warnings; use strict; print "testing seek of DATA handle\n"; print "this will print this program\n"; seek (DATA,0,0); my $text = do{ local $/ = undef; <DATA>; }; print $text; __DATA__ asdfasdf asdfasdf
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^6: Error binmode() on unopened filehandle
by jo37 (Curate) on May 03, 2020 at 14:54 UTC | |
|
Re^6: Error binmode() on unopened filehandle
by ikegami (Patriarch) on May 04, 2020 at 03:27 UTC |