The value of $RTBL_ENTRY_DEL is:'g2222222|mvs+VSPMVSPNODE' s/$RTBL_ENTRY_DEL//; But only the g2222222 is removed leaving the "|MVS+VSPMVSPNODE". I tried negation of the pipe in the same sustitution line with no success. #### #!/usr/local/bin/perl -w use strict; use Fcntl qw(:flock); #-------------------- my $CE_PMID = 'g2222222' ; my $RTBL_CD_NODE_CONST = '|mvs+VSPMVSPNODE' ; my $CE_ROUTE_TABLE = "/edi/cdunix/ndm/bin/Rout.Tbl"; my $RTBL_ENTRY_DEL = $CE_PMID . $RTBL_CD_NODE_CONST; #-------------------- if ( $CE_PMID =~ /g*/ ) { open(CE_RTBL, "<$CE_ROUTE_TABLE") || die "Couldnt read from routing table: $!"; my @RTBL_Array = ; close(CE_RTBL) || die " Couldnt close file: $!"; my @RTBL_Match = grep { /$RTBL_ENTRY_DEL/ } @RTBL_Array; if ( @RTBL_Match ) { print "It matched!!!\n"; open(CE_RTBL,"+<$CE_ROUTE_TABLE"); flock(CE_RTBL, 2) or die "Can't file lock $CE_ROUTE_TABLE: $!"; print "Inside flock:$RTBL_ENTRY_DEL\n"; for (@RTBL_Array) {s/$RTBL_ENTRY_DEL//g}; close (CE_RTBL) || die "Can't close $CE_ROUTE_TABLE: $!"; } #End of if } #End of if #### #### o2130338|mvs+VSPMVSPNODE g2139819|mvs+VSPMVSPNODE g2113717|mvs+VSPMVSPNODE o2156228|mvs+VSPMVSPNODE o2170511|mvs+VSPMVSPNODE o2174150|mvs+VSPMVSPNODE o2194340|mvs+VSPMVSPNODE o4199702|mvs+VSPMVSPNODE g2345678|mvs+VSPMVSPNODE g2222222|mvs+VSPMVSPNODE