Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re: Re: Anyone use "xor" in conditionals?

by BUU (Prior)
on Jul 14, 2003 at 04:29 UTC ( #273876=note: print w/ replies, xml ) Need Help??


in reply to Re: Anyone use "xor" in conditionals?
in thread Anyone use "xor" in conditionals?

Wouldn't that (next if -d $dir1 xor -d $dir2) be exactly the same as next if -d $dir1 == -d $dir2 ? Why would you choose xor over that?


Comment on Re: Re: Anyone use "xor" in conditionals?
Select or Download Code
Re: Anyone use "xor" in conditionals?
by Abigail-II (Bishop) on Jul 14, 2003 at 06:11 UTC
    Because I have warnings turned on.

    Abigail

      perl -we"print 'omg' if -d 'bcc' == -d 'cygwin'"

      That doesn't raise an error on my windows box, or even a warning and works exactly as expected?
        Try it with a non-existent directory. Perl will warn if you do a numeric comparison with an undefined expression, while undef will evaluate as false in a boolean comparison.

        HTH

        PS Change the 'if' in your original node to 'unless', but I'm guessing you already know that...

        $ perl -we"print 'omg' if -d 'bcc' == -d 'cygwin'" Use of uninitialized value in numeric eq (==) at -e line 1. Use of uninitialized value in numeric eq (==) at -e line 1. omg$ ls bcc cygwin ls: bcc: No such file or directory ls: cygwin: No such file or directory $

        Abigail

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://273876]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (6)
As of 2014-09-22 04:13 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (178 votes), past polls