in reply to Is there a better way of dealing with !~ and "Useless use of not in void context at" warnings?

Just to elaborate on what the others have said,

$str !~ s/junk//g;

means

!( $str =~ s/junk//g );

In fact, both generate exactly the same opcode tree. You'd expect the latter to warn in void context, right? Well, so does the former. So just drop the negation.

$str =~ s/junk//g;
  • Comment on Re: Is there a better way of dealing with !~ and "Useless use of not in void context at" warnings?
  • Select or Download Code