use strict; use warnings; my ($output_file) = 'a.exe'; open INPUT, $output_file or die "Cannot read the installer file $output_file: $!"; binmode INPUT; my $content = ""; my $buffer; while ( read (INPUT, $buffer, 65536) # read in (up to) 64k chunks, write ) { if ($!){die $!} $content.=$buffer; }; die "Cannot read the installer file $output_file: $!" if $! && ($! ne 'Bad file descriptor'); close INPUT; return $content; #### Bad file number at a.pl line 13.