in reply to Re^2: How to eliminate warning message on hash value?
in thread How to eliminate warning message on hash value?

As a minor note, I would get rid of the nested if and replace that with an "and".

Your code gets wrapped (with default PM settings), and is thus less readable. The line break was intentional, at which point "if" works better.

  • Comment on Re^3: How to eliminate warning message on hash value?

Replies are listed 'Best First'.
Re^4: How to eliminate warning message on hash value?
by Marshall (Canon) on Dec 20, 2011 at 05:23 UTC
    I updated the post. I didn't notice the line length issue before. Lines on PM are shorter than I normally use, but this is solved easily as shown. Very complicated conditions can be made readable in this "vertical" manner.

    Update: As a historical note, I learned this method from Daniel McCraken when I was working with FORTRAN IV some years ago.

      I didn't say it couldn't be done, I said "if" worked better. (No artificial code placement, nested instead of zizag indenting.)
        Well, I wrote this code today and I think it illustrates this style better...

        Of course what these variables mean is completely out of context, but I can't imagine the horror of this expressed as nested "if's". Call it "zigzag indenting" or whatever.

        For more complex "if" statements, I do think this has a certain regularity that is pleasing to the eye. Mileage varies.

        print if ( exists ($noBye4Call{$rCall} ) and ($rNr > 10 ) and ($GP{STATUS} eq 'G' ) and ($GP{SCORE} eq 'BYE') );