use strict; use warnings; my $INPUT; my $OUTPUT; open($INPUT, "<", "my_input_file.txt"); #the "<" tells it you want to read from the file open($OUTPUT, ">" "my_output_file.txt"); #the ">" tells it you want to write to the file. while(my $line=<$INPUT>){ #.. do some changes to $line .. print $OUTPUT $line #prints $line (after I've done whatever changes) to the file I opened as $OUTPUT }