in reply to Error binmode() on unopened filehandle
$binary is not a file handle. It's a normal scalar variable that you've stuffed the entire contents of the file into.
Side note... you're best to use the three argument form of open(), and use a lexical file handle as opposed to a bareword global one:
open my $fh, '<', 'file.ext' or die "Can't open file: $!"; while (<$fh>) { ... }
|
|---|