use warnings; use strict; # use IO::File; my $file = shift; open(my $fh, ">", $file); foreach my $i (1 .. 10) { print $fh $i, "\t", $i**$i, "\n"; # $fh->print($i, "\t", $i**$i, "\n"); } close($fh); # $fh->close();