in reply to Re^2: His strangeness regex
in thread His strangeness regex

Nevertheless I'm still interested why now the use of the variable $prefixSnmpWalk works.

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

    I'm sorry - but it's not the input. The line you marked out was the workaround. Still I don't got any idea why I had to do the dirty way instead of using the variabel. I know the variabel to work normally - I'm used to it to see it running this very way. But I was perplexed that all of a sudden it didn't worked properly anymore.

    And astonihing is the fact that the nice short term worked as expected. For this very fact I'm interested in.

      I'm sorry - but it's not the input.

      Why don't you provide some input?

      The line you marked out was the workaround. Still I don't got any idea why I had to do the dirty way instead of using the variabel.

      Thanks, I knew that. I was demonstrating that the variable way was working.

      I know the variabel to work normally - I'm used to it to see it running this very way. But I was perplexed that all of a sudden it didn't worked properly anymore.

      I'm not saying I don't believe you, but prove it or it didn't happen :)

        To make it short:

        $ > snmpwalk omServer1 .1.3.6.1.2.1.1.1 system.sysDescr.0 : DISPLAY STRING- (ascii): Sun SNMP Agent, Ultra-80 $ > snmpwalk omServer2 .1.3.6.1.2.1.1.1 system.sysDescr.0 : DISPLAY STRING- (ascii): IBM PowerPC CHRP Compute +r Machine Type: 0x0800004c Processor id: 00C9FC8A4C00 Base Operating System Runtime AIX version: 05.03.0000.0060 TCP/IP Client Support version: 05.03.0000.0063 $ > snmpwalk omServer3 .1.3.6.1.2.1.1.1 snmpwalk: No response arrived before timeout.

        That's the output to be processed