in reply to Overloading ref() just like ->isa and ->can?
use strict; use warnings; { package foo; sub new { bless {}, shift}; } my $foo = foo->new(); print "ref(foo) = ",ref($foo), "\n"; print "foo is a hash\n" if UNIVERSAL::isa($foo,'HASH'); my $bar = {a => 1}; # The following won't work # print "bar is a hash\n" if $bar->isa('HASH'); print "bar is a hash\n" if UNIVERSAL::isa($bar,'HASH');
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Overloading ref() just like ->isa and ->can - best practice for isa(HASH)?
by diotalevi (Canon) on Aug 22, 2006 at 19:12 UTC |