develooper Front page | perl.perl5.porters | Postings from May 2004

void context !~ generates "Useless use of not at line..." warning

Thread Next
From:
Yitzchak Scott-Thoennes
Date:
May 9, 2004 00:59
Subject:
void context !~ generates "Useless use of not at line..." warning
Message ID:
20040509075919.GA3752@efn.org
$ perl -we'"" !~ //'
Useless use of not in void context at -e line 1.

Because there isn't actually a not or ! operator there, I'd like to
see this changed:

--- perl/op.c.orig	2004-04-07 01:01:29.000000000 -0700
+++ perl/op.c	2004-05-08 23:18:44.681518400 -0700
@@ -661,6 +661,15 @@ Perl_scalarvoid(pTHX_ OP *o)
 	    useless = OP_DESC(o);
 	break;
 
+    case OP_NOT:
+       kid = cUNOPo->op_first;
+       if (kid->op_type != OP_MATCH && kid->op_type != OP_SUBST &&
+           kid->op_type != OP_TRANS) {
+	        goto func_ops;
+       }
+       useless = "negative binding operation";
+       break;
+
     case OP_RV2GV:
     case OP_RV2SV:
     case OP_RV2AV:
End of Patch.

Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About