INPUT FILE(p4diff.log) DATA:- missing E:\qdepot_automation\addfiles.txt same E:\qdepot_automation\AMSS\products\build\ms\files.data same E:\qdepot_automation\AMSS\products\build\ms\build.cmd missing E:\qdepot_automation\AMSS\products\build\textfiles.txt same E:\qdepot_automation\AMSS\products\build\ms\lib.min #!/usr/bin/perl -w use strict; use warnings; use Cwd; my $client_root="E:\\qdepot_automation"; my $perforce_root_dir="\/\/depot\/code"; my $input = ; my $line; #my ($client_root,$clientroot); open(my $OUTPUT, '+>', "perforcefiles.txt") or die $!; open my $DATA, '<', $input or die "could not open '$input' $!"; while ($line = <$DATA>) { if ($line =~ /missing/) { $line =~s/\\/\//g; $line =~s/$client_root/$perforce_root_dir/g; ###This line is not working,basically am not able to replace client_root with perforce_root_dir print "$line\n"; print $OUTPUT $line; } } close OUTPUT; OUTPUT:- E:\qdepot_automation>perl deletefiles.pl Name "main::OUTPUT" used only once: possible typo at deletefiles.pl line 25. missing E:/qdepot_automation/addfiles.txt