# Set your input and output file my $inputfile = "input.txt"; my $outputfile = "output.txt"; # Open your input file open(my $input, $inputfile); # Open your output file, for writing open(my $output, ">$outputfile"); # Read each line in, one at a time while(<$input>) { # Here's where you put your personal logic # When you need to print to the output file, do this # The $_ means, in this case only, "current line" print $output "Hey, I found $_\n"; } # Close your files when done! close($input); close($output);