On Wed, Sep 13, 2000 at 12:00:49PM +0100, raptor wrote:
> hi,
> 
> I was thinking will it be good if the braces are used but not required for
> ops like while, until, if, unless ...etc... what I have in mind :
> 
> if  $x > 10 print $x;
> work as
> if ($x > 10) {print $x};
> 
> OR
> 
> while $i < 10 print $i;
> mean
> while ($i < 10) { print $i };

You do realize, of course, that if you reverse these statements and
put the if and while at the end, then you don't need the parens:

print $x if $x > 10;
print $i while $i < 10;

(Although the latter is an infinite loop if $i < 10.)

> I know that some will tell that when the condition is more complicated this
> will not work for the readability of the program, but there we can still use
> braces...
> this is only the shortcut, and will make things clearer for shorter
> things...

I won't, but I will refer you to perldoc perlsyn, particularly the
section on "Simple statements".

Walt

Reply via email to