Looks like left is always evaled in list, and right is never even checked. But then where does the scalar issue of .. come in.. argh!sub leftt { wantarray ? print "Left is list\n" : print "Left is scalar\n"; return 1; } sub rightt { wantarray ? print "Right is list\n" : print "Right is scalar\n"; return 1; } sub leftf { wantarray ? print "Left is list\n" : print "Left is scalar\n"; return 0; } sub rightf { wantarray ? print "Right is list\n" : print "Right is scalar\n"; return 0; } print "true or true \n"; @test = leftt() or rightt(); print "\@test = @test\n"; print "true or false\n"; @test = leftt() or rightf(); print "\@test = @test\n"; print "false or true\n"; @test = leftf() or rightt(); print "\@test = @test\n"; print "false or false\n"; @test = leftf() or rightf(); print "\@test = @test\n"; __END__ Output: true or true Left is list @test = 1 true or false Left is list @test = 1 false or true Left is list @test = 0 false or false Left is list @test = 0
In reply to Re: Re: for loops and 'and'
by jweed
in thread for loops and 'and'
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |