if( $res =~ /58=Invalid/ and not $res =~ /59=3/ ) { grobble_error( $res ); } else { print "58=Invalid and 59=3\n"; }