use strict; use warnings; use Time::HiRes qw( time ); my $start = time(); my $input_file = $ARGV[0]; my $data = do { local $/ = undef; open (my $fh, "<", $input_file) or die "could not open $input_file: $!"; binmode($fh); <$fh>; }; my $reversed_data = pack( "v*", unpack( "n*", $data ) ); open my $output, '>', "bkpps3.swap.bin"; binmode($output); print $output $reversed_data; my $end = time(); my $runtime = sprintf( "%.16s", $end - $start ); print $runtime;