in reply to Writing to an output file

Hi,

open(FH, '<', $filename) or die ...

Better written as

open(my $IN_FH, '<', $filename) or die ...; while (<$IN_FH>) { ... }

So, if "<" is the second arg for when you want to read from a file ...

See (please, for goodness' sake, see) https://perldoc.perl.org/perlintro.html#Files-and-I%2fO


The way forward always starts with a minimal test.