Gurus,

I'm not really a newbie, I have a few years of Perling, but this one's got 
me stumped. I remember that "&&" is supposed to short circuit (skip B 
completely in "A && B" if A is false), but in my code it won't. So what's 
the deal?

<code>
($x eq 'T') && next if value_in_list( $u, @listA );
($x eq 'A') && next if value_in_list( $u, @listB );
($x eq 'B') && next if value_in_list( $u, @listC );
</code>

where value_in_list() is a sub that returns TRUE if $u is found in the 
list it gets passed, and FALSE otherwise.

I've tried replacing the "eq 'X'" with "=~/X/" and that doesn't help.  I 
even tried replacing the "&&" with "and".  No joy. I still get the sub 
entered for each possible value of $x unless the sub returns TRUE on a 
previous test. That is, if $x is 'B', the sub gets entered for all three 
possibilities, T, A, and B.  I think this shouldn't be happening, but it 
is (well, was, now I'm using a really ugly if-elsif-elsif).  Any hints as 
to why my && ain't workin' like it oughta?

TIA,

Deane Rothenmaier
Systems Architect
Walgreens Corp.
847-914-5150

"On two occasions I have been asked [by members of Parliament], 'Pray, Mr. 
Babbage, if you put into the machine wrong figures, will the right answers 
come out?' I am not able rightly to apprehend the kind of confusion of 
ideas that could provoke such a question." -- Charles Babbage
_______________________________________________
ActivePerl mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to