open(INPUTFILE, "< input.txt") or die "cannot open file for reading $!"; open(OUTPUTFILE, "> output.txt") or die "cannot open file for writing $!"; ..... code goes here close INPUTFILE; close OUTPUTFILE;