Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
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 ( [id://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
Domain Nodelet?
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?Last hourOther CB clients
Other Users?
Others imbibing at the Monastery: (4)
As of 2024-04-16 17:46 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found