#! /usr/bin/perl -w use strict; use warnings; use String::Random; exit if (@ARGV < 2); my ($file, $sizeKB) = @ARGV[0, 1]; open FILE, ">$file"; binmode FILE; my $i = 0; while ($sizeKB - $i++ > 0) { print FILE String::Random->new->randregex("[A-Za-z0-9]{1023}"), "\n"; print "output $i KB...\r"; }