Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
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 studying the Monastery: (4)
As of 2015-04-01 05:33 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found
    past polls