open (SNMP1, "abc.sh |") or die "Cannot run abc.sh $!"; while () { # do some processing } close (SNMP1) or die "ERROR: testing $! $?\n ";