in reply to Re^2: iterative foreach loop
in thread iterative foreach loop

Yes, looks ok to me. Just two minor nitpicks: note the difference between the filenames TEXT2.txt and input.txt, error messages might be a little confusing, so I'd recommend putting the filename in a variable and saying open(my $fh, '<', $filename) or die "Can't open $filename: $!";. Also, and this is very minor, you don't have to put $_ in quotes. For clarity, you could also use a named variable instead of $_, as in while (my $line = <$in>) { print $line; } (Update: I just saw that Laurent_R showed this as well).