in reply to Re: What protects me from doing this stupid thing..?
in thread What protects me from doing this stupid thing..?

Sorry, I've just realised that my error was elsewhere, and the code does in fact work. Thanks for the help with undefined versus false though.


Nobody says perl looks like line-noise any more
kids today don't know what line-noise IS ...
  • Comment on Re^2: What protects me from doing this stupid thing..?

Replies are listed 'Best First'.
Re^3: What protects me from doing this stupid thing..?
by syphilis (Archbishop) on Aug 12, 2007 at 03:04 UTC
    Still, I thought there was (arguably) a valid point made.

    Given that perl -we '10' produces the "Useless use of a constant in void context" warning, couldn't it be argued (by someone that wanted to be extremely picky) that perl -we '0 || 10' should produce the same (or similar) warning ?

    Cheers,
    Rob
      They might be picky, but it's morely likely they misunderstand the meaning of "Useless" in this context. Execution of perl -we "10" returns an error because it does absolutely nothing. In contrast, perl -we "0 || 10" makes a choice. It matters not that the choice is ultimately unnecessary. The constant value is examined in order to make the choice; therefore, it is a useful value. Perl cannot be expected to determine whether or not a programmer makes poor choices. It's like the Oracle: it cannot see past a choice it does not understand.