Quoth
:
> Here is a piece of code from a simple program I wrote to do some FTPing. I
> was wondering if the form of my statement is acceptable with respect to the
> use of 'and' and 'or'. I did it, hoping for the best, and it seems to
> work. I am always shaky on rules of precedence and usually use lots of
> ()'s to make sure I get it right, but I am trying to wean myself off of
> them.
>
> if ($user and $pass)
> {
> $ftp->login($user, $pass)
> and print "successfully logged on to $server as $user\n"
> or print "problem logging on to $server as $user\n";
> }
I must say, I have always wanted a low-precedence version of ?:, perhaps
'... then ... else ...', for just this situation.
Ben
--
'Deserve [death]? I daresay he did. Many live that deserve death. And some die
that deserve life. Can you give it to them? Then do not be too eager to deal
out death in judgement. For even the very wise cannot see all ends.'