Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re^3: What is the best way to compare variables so that different types are non-equal?

by ikegami (Pope)
on Jul 21, 2009 at 17:56 UTC ( #782037=note: print w/ replies, xml ) Need Help??


in reply to Re^2: What is the best way to compare variables so that different types are non-equal?
in thread What is the best way to compare variables so that different types are non-equal?

That can result in false positives.

my $r = \@a; print comparifier($r, "ARRAY$r") ?1:0,"\n"; # 1


Comment on Re^3: What is the best way to compare variables so that different types are non-equal?
Download Code
Re^4: What is the best way to compare variables so that different types are non-equal?
by jdporter (Canon) on Jul 21, 2009 at 22:27 UTC

    True enough.

    sub comparifier { no warnings 'uninitialized'; # because blessed() and reftype() can + return undef. my $sep = pack 'N', rand 2**15; blessed($_[0]) . $sep . reftype($_[0]) . $sep . $_[0] eq blessed($_[1]) . $sep . reftype($_[1]) . $sep . $_[1] }
    Between the mind which plans and the hands which build, there must be a mediator... and this mediator must be the heart.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (4)
As of 2015-07-06 03:06 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (69 votes), past polls