If you set the binmode option, then the file will be slurped in binary mode. my $bin_data = read_file( $bin_file, binmode => ':raw' ) ;