in reply to Re^2: Not able to replace to directory paths
in thread Not able to replace to directory paths

Maybe you should close $P4DIFF before you open the associated file?

Depending on how much you've written, the IO buffer (size 4k) might not have been flushed yet, so the file behind $DATA could be empty.  In other words, you'd get EOF with the loop quitting right away...

This doesn't print anything (i.e. while loop not entered):

open(my $P4DIFF, '+>', "p4diff.log") or die $!; print $P4DIFF "foo\n" x 3; # close $P4DIFF; my $input = "p4diff.log"; open my $DATA, '<', $input or die "could not open '$input' $!"; while (my $line = <$DATA>) { print ">> $line"; }

while if you uncomment the close, you'd get:

>> foo >> foo >> foo