Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask

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
    ref (?-xism:a) (regex) is 'Regexp': true
    comparing literals: qr{a} eq '(?-xism:a)': true
    comparing variables: regex eq (?-xism:a) (string): true

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://781447]
Approved by Bloodnok
Front-paged by LanX
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (4)
As of 2015-07-04 00:39 GMT
Find Nodes?
    Voting Booth?

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

    Results (57 votes), past polls