#!/usr/bin/perl -w die "Usage: hexperlscript \n" unless @ARGV == 2; my ($input, $output) = @ARGV; die "Blocksize must be divisible by 512.\nExiting.\n" unless $input % 512== 0; $input /= 2; open ( DEST, '>>', $output ) or die "Cannot create ouput file. $! \n"; while (1) { for (0..0xff) { my $n = sprintf "%02x", $_; print DEST $n x $input or die "Could not print: $!\n"; } }