Are we making this too complicated? If all you want is to create a character string of a given length, perhaps what you need is just the "x" command applied to a simple one-byte ascii character.
#!/usr/bin/perl -w
use strict;
my $len = 0;
if (@ARGV >= 1) {
$len = $ARGV[0];
}
$len > 0 || die "Usage: genlen.pl number\n";
print "a" x $len;