On Fri, Jan 10, 2003 at 11:53:15AM -0600, Jensen Kenneth B SrA AFPC/DPDMPQ wrote:
> From: Tim Musson [mailto:[EMAIL PROTECTED]] 
> > 
> > JKBSAD> $one = 1;
> > 
> > JKBSAD> ($one == 1) ? (print "\$one equals", print "$one") : (print 
> > JKBSAD> "\$one does not ", print "equal 1");
> > 
> > Why the double print statements?
> 
> The two print statements were there for the sake of having 2 commands.

print "\$one equals", print "$one"

is just one statement.  It is a print statement which prints a list.
The first element in the list is the string "\$one equals".  The second
element is the result of the expression C<print "$one">.  To determine
the result of that expression it is executed, with the side effect of
printing "$one".  The return value is true (1 in this case) if the print
succeeded.

So the final list printed is ("\$one equals", 1).

> Seems to me that multiple commands are executed in reverse order (right to
> left).

No.  Statements are always executed in the order they are encountered.
If that does not suit you, check out Befunge and other similar
languages ;-)

-- 
Paul Johnson - [EMAIL PROTECTED]
http://www.pjcj.net

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to