in reply to Re^5: Error binmode() on unopened filehandle
in thread Error binmode() on unopened filehandle
Naw, you just need to set $/ appropriately. There is no real difference between
andbinmode $fh; read($fh, my $buf, 20000);
binmode $fh; local $/ = \20000; my $buf = <$fh>;
Of course, both are junk. Why would you only read the first 20,000 bytes? The following make more sense:
orbinmode $fh; my $file = ''; 1 while read($fh, $file, 8*1024, length($file));
binmode $fh; local $/; my $file = <$fh>;
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^7: Error binmode() on unopened filehandle
by Marshall (Canon) on May 07, 2020 at 00:09 UTC | |
by ikegami (Patriarch) on May 07, 2020 at 18:57 UTC | |
by Marshall (Canon) on May 08, 2020 at 22:22 UTC | |
by ikegami (Patriarch) on May 09, 2020 at 08:27 UTC | |
by Marshall (Canon) on May 10, 2020 at 23:29 UTC |