sub if ($? > 0 ) { $? = 0; } if ( defined(SNMP) ) { close SNMP; } print " /@/ gettable called ($?)\n"; my ($target,$table,$fieldstring,$comstr) = @_; $snmpCmd = "mibtable -table $table -fields $fieldstring -node $target |"; open (SNMP, $snmpCmd ) || die print STDERR "Couldn't open pipe: $! \/ $? \/ $@\n"; $error = $?; while () { # do stuff } my $closed = 13; $closed = close (SNMP) || $! ? "Error closing sort pipe: $!" : "Exit status $? from sort"; print "\tDid filehandle get closed: '$closed'\n"; undef SNMP; print STDERR "!!!! $! \/ $? \/ $@\n"; #### dncms@case3 ~ 621 > perl testSnmp2.pl node /@/ gettable called (0) snmpCmd: 'mibtable -table table1 -fields fields1 -node node |' pid: 1168 -1- (bootflash 65451748 65536000) -2- (sw1-slot2-dfc-bootflash 15990784 15990784) -3- (sw1-slot3-dfc-bootflash 15990784 15990784) -4- (sw1-slot6-dfc-bootflash 15990784 15990784) -5- (sw1-slot7-dfc-bootflash 15990784 15990784) Error retrieving information from node No response arrived before timeout Did filehandle get closed: 'Exit status 256 from sort' !!!! / 256 / END GETTABLE (What is $?: 256) Errno from pipe: (piped exit code: 1) / (signal: 0) / (core dump: 0) [0] What is $?: 256 /@/ gettable called (0) snmpCmd: 'mibtable -table table1 -fields fields2 -node node |' pid: 1171 Error retrieving information from node No response arrived before timeout Did filehandle get closed: 'Exit status 256 from sort' !!!! / 256 / END GETTABLE What is $?: 256