in reply to Re: Re^2: helping along $_
in thread helping along $_

Actually, 0 and 1 are special-cased in perl to not throw a warning. Consider:
$ perl -w -e'1;' -e'10;' Useless use of a constant in void context at -e line 2

Makeshifts last the longest.

Replies are listed 'Best First'.
Re**5: helping along $_
by belg4mit (Prior) on Sep 09, 2002 at 16:47 UTC
    Yes, okay. But that doesn't really affect how this hypothetical behavior for ARGHelper would be, does it? It simply means that defining what constitutes assignment with the same parameters as what incurs the warning is slightly too restrictive (as it leaves out 0 and 1), but the idea is still there and otherwise valid. I don't think you've made your case as to how this could negatively affect things; I already pointed out the bit about scope. An assignment returns its value, so the statement still evaluates to 0 or 1, whether or not an assignment is taking place.
    % echo '$_=0;' >! /tmp/a.pm ; perl -Mlib=/tmp -Ma a.pm did not return a true value. BEGIN failed--compilation aborted.

    --
    perl -pew "s/\b;([mnst])/'$1/g"

      I didn't have a case to make, just a gut feeling that this has potential break something in an obscure way. The things I mentioned were what came to mind at the moment.

      Makeshifts last the longest.