[EMAIL PROTECTED] writes:
> On Fri, Apr 12, 2002 at 04:00:37PM +0100, Piers Cawley wrote:
>> <X-posting to perl6-language>
>> [EMAIL PROTECTED] writes:
>> > As for "cleanness", this is my interpretation of how perl6 is going
>> > to work:
>> >
>> > %foo = ();
>> > if %foo {"key"} {print "Hello 1"}
>> > ####
>> > %foo = ();
>> > if %foo{"key"} {print "Hello 2"}
>> > ####
>> > %foo = ();
>> > if %foo{"key"}{print "Hello 3"}
>> >
>> > Case 1 will print "Hello 1"; this is a block after the if statement.
>>
>> No, it will be a syntax error. The first closing brace does not end
>> the statement, probably something like "Block seen when keyword
>> expected".
>
> Now I am confused. In perl6, we can leave off the the parenthesis
> around a condition, and I hope that it isn't required to have
> an 'elsif' or 'else' block.
>
> Why isn't
>
> if %foo {"key"} {print "Hello 1"}
>
> equivalent with the perl5 syntax:
>
> if (%foo) {"key"} {print "Hello 1"}
>
> Which keyword is it expecting?
Keyword /els(e|if)/, or end of line, or semicolon. Sorry badly phrased
on my part. The closing brace of {"key"} only ends the statement if it
is followed by /\s*$/, or a semicolon.
--
Piers
"It is a truth universally acknowledged that a language in
possession of a rich syntax must be in need of a rewrite."
-- Jane Austen?