>On Mon, Oct 06, 2003 at 05:55:21AM -0700, Abigail wrote: >> -Returns a true value if EXPR is a reference, false otherwise. If EXPR >> +Returns a non-empty string if EXPR is a reference, the empty >> +string otherwise. If EXPR >> is not specified, C<$_> will be used. The value returned depends on the >> type of thing the reference is a reference to. >> Builtin types include: >This reads a little better. > Returns the reference type or class if EXPR is a reference, the empty > string otherwise. >I also reindented. I don't think its necessary to go into a discussion >of edge cases nor to rework the example to say "if(ref($r) eq '')" instead >of "unless(ref($r))" because honestly I don't think anyone is going to >go around and change all their code in case some joker sets their classname >to 0. I'm not sure this is optimal. It seems to lead people into getting persnickety about the particulars of their true and false values. Simple logical tests make for clearer code, and, as you seem to point out, getting them to work around the joker is silly enough that the joker gets what he deserves. Compare with testing for whether a match or substitute succeeds or fails. The actual result in the failure case is "" (and a special one, at that!), but the success case gives you a more obviously numeric result. But it's best to just let people do a if (m/../) or such. --tomThread Previous | Thread Next