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

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

by ELISHEVA (Prior)
on Jul 19, 2009 at 15:19 UTC ( #781447=perlquestion: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    use strict;
    use warnings;
    ...
      , (qr{a} eq '(?-xism:a)'?'true':'false'), "\n";
    print "comparing variables: regex eq $s (string): "
      , ($s eq $re?'true':'false'), "\n";
    
  2. or download this
    -------Type------------
    ref (?-xism:a) (regex) is 'Regexp': true
    ...
    -------Equality--------
    comparing literals: qr{a} eq '(?-xism:a)': true
    comparing variables: regex eq (?-xism:a) (string): true
    

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://781447]
Approved by Bloodnok
Front-paged by LanX
help
Chatterbox?
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (9)
As of 2018-01-16 09:48 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    How did you see in the new year?










    Results (175 votes). Check out past polls.

    Notices?