All pastes #424465 Raw Edit

Something

public text v1 · immutable
·published 2007-04-04 20:21 UTC
rendered paste body
#!/usr/bin/perl

my $input  = $ARGV[0] or die "Usage: $0 <input> <output>";
my $output = $ARGV[1] or die "Usage: $0 <input> <output>";

open(my $in_fh,  '<', $input)  or die "Unable to open '$input'  for reading: $!";
open(my $out_fh, '>', $output) or die "Unable to open '$output' for writing: $!";
{
    local $/ = \3200;
    my $header = <$in_fh>;
    print $out_fh $header;
}
local $/ = \1;
while (<$in_fh>) {
   my $little = unpack 'v', $_;
   my $big = pack 'n', $little;
   print $out_fh $big;
}
__END__