in reply to Re^3: Looking for less code
in thread Looking for less code

Point 1: You should run with both "warnings" and "strict" enabled.
I know. Still it's not an error, and still you should also use Data::Dumper (or better) for debugging (and then you don't even get a warning). But didn't I say that already?
Point 2: I recommend taking some 'C' classes and you will understand the difference between "undef" and "zero".

How do C classes help me here? To understand that an undef doesn't create an IV?

I also know the difference between 0 and undef in perl. How does that relate to my second point? Both evaluate to false in boolean context, without warning.

Replies are listed 'Best First'.
Re^5: Looking for less code
by Marshall (Canon) on Aug 11, 2009 at 09:35 UTC
    We are getting away from OP's question.

    I apologize for evidently starting that diversion. That was not my intent.

    Update:

    The OP wants to simplify some series of "if" statements. My personal opinion about a "false" value is that it should be a "defined value". BUT, an undef can be used in the false sense in an "if" statement!! No problem!! This will work!!

    If folks got the idea that I meant that "undef" did not equate to false, I certainly didn't mean that. As that is wrong! Undef will evaluate to "false".

    I personally think that when you assign a "false" value to a $var that "false" value should be "defined". Valid false values are single quotes '', double quotes "" and 0 and YES, undef. Using a "defined value" has advantages like when you print that $var, you don't get a run time error "undefined $var".