in reply to Annoying warnings...
( reftype $x or '' ) eq 'HASH'Has any of you, by any chance, found a more clueful approach to dealing with these annoying warnings?
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
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Annoying warnings...
by adrianh (Chancellor) on Jul 16, 2005 at 14:51 UTC | |
|
Re^2: Annoying warnings...
by tlm (Prior) on Jul 16, 2005 at 13:07 UTC |