$|=1;
$x = open IN,"< input.txt"; # try to open the filehandle for reading
if(!$x){  # it failed!
  die "Unable to open input file: $!";
}

$x = open OUT,"> output.txt"; # try to open the filehandle for writing
if(!$x){ # it failed!
  die "Unable to open output file: $!";
}

@strings = <IN>;           # read the input file (IN stream)
chomp @strings;

$ruler = "1234567890" x 6;
print OUT "$ruler\n";      # print to output file (OUT stream)

foreach $e (@strings){
  printf OUT "%20s\n",$e;  # also works for printf
}
close IN;                  # don't forget to close your filehandles
close OUT;
