Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
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 the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (8)
As of 2014-12-20 22:35 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (99 votes), past polls