in reply to Re^3: Replacing an entire line if a substring is found
in thread Replacing an entire line if a substring is found

I imagine you have seen and copied syntax like:

my $data = do { local $/, <DATA> };
... which Monks use a lot around here to demonstrate solutions using data contained in the script.

But in your case, if you are interested in handling the lines one at a time, and they exist in a separate file, there's no good reason to combine them all in a scalar.

open my $fh, '<', $filename or die $!; while ( <$fh> ) { ... # process one line at a time }

Hope this helps!


The way forward always starts with a minimal test.