Is there a way I can read a binary without saving it as an array?
I have a very large binary that I need to read in half. And saving it as an array takes a lot of time, so I want to prevent this. I don’t care what happened to the file.
$size = stat($args{file});
my $vector;
open BIN, "<$args{file}";
read(BIN, $vector, $size->[7], 0);
close BIN;
my @unpacked = split //, (unpack "B*", $vector);
return @unpacked;
source
share