Think about Loose Coupling | |
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
( reftype $x or '' ) eq 'HASH' Ugg — that's ugly, and quite obfuscated: it isn't apparent from glancing at that code exactly what it does or that it's written like that to avoid a warning. Creating a new block with that particular warning disabled at least has the advantage of making it absolutely clear what you're doing. A clearer way of doing the above without a block is simply to test $x for being true (since all refs are true) first — this avoids the mysterious empty string constant and translates quite well into the equivalent English: $x && reftype $x eq 'HASH'(By the way I think it's slightly insulting of you to ask if any of us have suggestions for this "by any chance" — implying that we only discover things randomly rather than through having intelligence or talent!) Smylers In reply to Re: Annoying warnings...
by Smylers
|
|