Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re: Behaving appropriately based on ref() result

by tirwhan (Abbot)
on Jan 08, 2006 at 14:55 UTC ( [id://521824]=note: print w/replies, xml ) Need Help??


in reply to Behaving appropriately based on ref() result

You could also use the reftype function from Scalar::Util. This has the advantage of

  1. Explicitly returning undef on a non-reference variable
  2. Returning the underlying data structure type when handed an object

for example:

use Scalar::Util qw(reftype); my $o=bless {},MyClass; print ref $o # prints "MyClass" print reftype($o) # prints "HASH"

There are ten types of people: those that understand binary and those that don't.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://521824]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others avoiding work at the Monastery: (3)
As of 2024-04-19 17:01 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found