meinke3 has asked for the wisdom of the Perl Monks concerning the following question:
So I tried something totaly different.....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 tri +ed negation of the pipe in the same sustitution line with no success.
It didn't work either...... Here's the table that I'm attempting to remove an entry from each has a new line terminator:#!/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 ta +ble: $!"; my @RTBL_Array = <CE_RTBL>; + 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"); fl +ock(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
If anyone would be kind enough to point me in the right direction I'd be very greatful.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
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: regex problem? deleting table entry
by zer (Deacon) on Mar 30, 2006 at 00:20 UTC | |
|
Re: regex problem? deleting table entry
by duff (Parson) on Mar 30, 2006 at 04:07 UTC | |
by meinke3 (Acolyte) on Mar 30, 2006 at 17:03 UTC |