undef and ref to undef

Uri Guttman uri at stemsystems.com
Wed Jun 18 16:50:04 BST 2008


>>>>> "ID" == Ian Docherty <londonperlmongers at iandocherty.com> writes:

  ID> Why would someone return \undef  rather than undef from a
  ID> function/method and what is the advantage?

  ID> Just something I came across recently that seemed rather odd.

do you mean a plain return() or return( undef )? in some situations you
need to know you have a data tree (even an empty one) and return \undef
will work. dumper can handle it directly and you know you sent back
something concrete vs a return() which returns an implicit undef or
empty list depending on context.

there are probably some other subtle reasons for sending \undef but i am
too crunchy at yapc::na to think of them now.

uri

-- 
Uri Guttman  ------  uri at stemsystems.com  --------  http://www.sysarch.com --
-----  Perl Code Review , Architecture, Development, Training, Support ------
--------- Free Perl Training --- http://perlhunter.com/college.html ---------
---------  Gourmet Hot Cocoa Mix  ----  http://bestfriendscocoa.com ---------


More information about the london.pm mailing list