use strict; use File::Binary qw{$BIG_ENDIAN}; my $data = []; for (0..100) { $data->[$_] = 0x0a; } my $fb_dst = File::Binary->new("./a"); $fb_dst->set_endian(2); # 2 is $BIG_ENDIAN... fast fix $fb_dst->open(">./a"); #binmode $fb_dst->{_fh}; # unmark this line to fix problem $fb_dst->seek(0x0); my $index = 0; do { $fb_dst->put_ui8($data->[$index++]); } while ($fb_dst->tell() < 0xff);