Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re: Re: Confused by a Conditional

by damian1301 (Curate)
on Jun 10, 2001 at 19:40 UTC ( #87300=note: print w/replies, xml ) Need Help??


in reply to Re: Confused by a Conditional
in thread Confused by a Conditional

delete

Tiptoeing up to a Perl hacker.
Dave AKA damian

Replies are listed 'Best First'.
Re: Confused by a Conditional
by Abigail (Deacon) on Jun 10, 2001 at 20:44 UTC
    Oh, goodie, you used an if. Care to quote the manual where it says that in the context of an if, eq propagates some magic to or to do what you suggest it is doing?

    Anyway, the following code uses if instead of unless, and it does not print "Damian is right"....

    #!/usr/bin/perl -w use strict; my $key = 'LOCUSLINK'; if (($key) eq ('ID' or 'TITLE' or 'GENE' or 'CYTOBAND' or 'LOCUSLINK' or 'CHROMOSOME' or 'SCOUNT')) { print "Damian is right\n"; }

    Your code only happens to do the right think if $key equals ID, or it's different from any of the clauses. It'll fail to work when the key equals TITLE, GENE, CYTOBAND, LOCUSLINK, CHROMOSOME, or SCOUNT.

    -- Abigail

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://87300]
help
Chatterbox?
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (13)
As of 2016-12-06 18:11 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    On a regular basis, I'm most likely to spy upon:













    Results (113 votes). Check out past polls.