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

Re^2: Multiple check in If statement ??

by Enlil (Parson)
on Jul 11, 2005 at 08:00 UTC ( #473862=note: print w/replies, xml ) Need Help??


in reply to Re: Multiple check in If statement ??
in thread Multiple check in If statement ??

This will not always work correctly without knowing a little more about the data.

For example in your code, it will print success if $d='de' and $e = '' even though it should print false according to the OP's original intent. Depending on what you know about the data, that will be in those variables however, you could probably do what you are intending, but joining both sides with a common delimiter and then comparing them. For example:

if ( join("->",$a,$b,$c,$d,$e) eq join '->',qw(a c c d e)) { print "success\n"; } else { print "failure\n"; }

-enlil

Replies are listed 'Best First'.
Re^3: Multiple check in If statement ??
by neniro (Priest) on Jul 11, 2005 at 08:12 UTC
    I hate to say it, but sometimes I type much faster than I think. Joining it using a delimiter is a much better idea than mine. I've added another code below thilosophies post that should be okay.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://473862]
help
Chatterbox?
[zentara]: are you talikng about perf?
[Discipulus]: i miss what an undocumented instructions can be, and how can be used
[zentara]: perf
[marto]: X86_instruction_li stings
[marto]: Illegal_opcode
[zentara]: marto arn't those NSA secrets? :-)
[marto]: not if you keep telling people :P
[zentara]: I had to disable hyperthreading on my machine because of that.
[Discipulus]: thanks marto but... at the moment this seems a bit beyond my faculties.. ;=)

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (14)
As of 2017-07-28 12:06 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    I came, I saw, I ...
























    Results (428 votes). Check out past polls.