you can also read the number from stdin:
$ echo 10 | perl -ane 'print "a" x $F[0]; print "\n"' aaaaaaaaaa