use strict; use warnings; my $size = 300; open my $file, ">", $size . "kb.txt" or die $!; print $file "*" x 1024 for 1 .. $size; close $file;