in reply to Re^2: His strangeness regex
in thread His strangeness regex
In the code you showed it always worked, your problem was always the input
# some declarations in the beginnings my $TAB = "\t"; my $SPACE = " "; my $oidNbrSysDescr = ".1.3.6.1.2.1.1.1"; my $prefixSysDescr = quotemeta 'system.sysDescr.0 : DISPLAY S +TRING- (ascii): '; my $prefixSnmpWalk = 'snmpwalk:\s*'; # no use ?? my $sysDescr = q~ snmpwalk: yeah ~; for ( $sysDescr ) { /$prefixSysDescr/ && do { s/$prefixSysDescr/$hostName$TAB/; $OutputLine = $_; last; }; # substitute some prefixes (this one works) # /snmpwalk:\s*/ /$prefixSnmpWalk/ && do { s/snmpwalk:\s*/$hostName$TAB/; $OutputLine = $_; last; }; # error messages starting with "snmpwalk: " # here is the problem. All of a sudden I coudln't # use $prefixSnmpWalk anymore. Even quotemeta # failed $OutputLine = $OutputLine . $SPACE . $_; } # process output die "$OutputLine "; __END__ yeah at - line 36.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: His strangeness regex
by o_chfa (Acolyte) on Sep 04, 2009 at 09:44 UTC | |
by Anonymous Monk on Sep 04, 2009 at 10:04 UTC | |
by o_chfa (Acolyte) on Sep 04, 2009 at 10:32 UTC | |
by Anonymous Monk on Sep 04, 2009 at 11:00 UTC | |
by o_chfa (Acolyte) on Sep 04, 2009 at 11:50 UTC | |
|