Plankton has asked for the wisdom of the Perl Monks concerning the following question:
Dear Monks,
I do not like getting warnings in my code but I like to use !~ to remove patterns of text from strings, you know ...
... but this generates ...$str !~ s/junk//g;
... messages because I like to "-w". I can suppress these warning messages by doing this ...Useless use of not in void context at ...
... but that might be a little confusing to someone that might end up maintaining my code (me :p ). Is there a more readable way to suppress the void context warnings?if ( $str !~ s/junk//g ) {}
Thanks
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Is there a better way of dealing with !~ and "Useless use of not in void context at" warnings?
by ikegami (Patriarch) on Jan 25, 2009 at 05:55 UTC | |
|
Re: Is there a better way of dealing with !~ and "Useless use of not in void context at" warnings?
by Your Mother (Archbishop) on Jan 25, 2009 at 05:28 UTC | |
by Plankton (Vicar) on Jan 25, 2009 at 05:53 UTC | |
|
Re: Is there a better way of dealing with !~ and "Useless use of not in void context at" warnings?
by GrandFather (Saint) on Jan 25, 2009 at 05:46 UTC | |
|
Re: Is there a better way of dealing with !~ and "Useless use of not in void context at" warnings?
by ysth (Canon) on Jan 25, 2009 at 10:00 UTC | |
|
Re: Is there a better way of dealing with !~ and "Useless use of not in void context at" warnings?
by davido (Cardinal) on Jan 25, 2009 at 06:12 UTC |