In alt.perl "Jürgen Exner" <jurgenex@hotmail.com> wrote:[color=blue]
> Mark Hobley wrote:[/color]
[color=blue]
> Did you mean
> BLOCK if (EXPRESSION);[/color]
Oops, yes I did. That was a typing error.
[color=blue]
> Anyway, both are wrong. Why don't you check the documenation?
> From "perldoc perlsyn":
>
> Any simple statement may optionally be followed by a *SINGLE* modifier,
> just before the terminating semicolon (or block ending). The possible
> modifiers are:
> if EXPR
>
> Because a block is not a simple statement. Did you try
> print 'Wow! Lucky Guess!' if ($guess == 6);
>[/color]
Yeah that works.
A professional programming guide tells me that the following forms of if
statement are legal in Perl:
STATEMENT if EXPRESSION;
STATEMENT, STATEMENT ... if EXPRESSION;
BLOCK if EXPRESSION;
Presumably there is a mistake in the text, and BLOCK if EXPRESSION should be
omitted from this list, because STATEMENT if EXPRESSION works, but
BLOCK if EXPRESSION appears not to.
Regards,
Mark.
--
Mark Hobley
393 Quinton Road West
QUINTON
Birmingham
B32 1QE
Telephone: (0121) 247 1596
International: 0044 121 247 1596
Email: markhobley at hotpop dot donottypethisbit com
http://markhobley.yi.org/