[Israel.pm] Re: Hebrew Perl Tutorial
roee_fr at netvision.net.il
Mon Aug 2 13:46:46 PDT 2004
roiem at actcom.co.il wrote:
>>2. On 2.3 you write that semicolon signifies end of line/command exactly
>>like C. This is wrong since it signifies a seperator between commands.
>Sorry, but I think the tutorial got it right:
>(From "perldoc perlsyn")
>Every simple statement must be terminated with a semicolon, unless it is
>the final statement in a block, in which case the semicolon is optional.
>Generally, my understanding is that the semicolon does work just like in
>C, but as a special case it is optional before the ending brace. I can't
>say that the behaviour isn't the same as what you said (i.e., Pascal's
>behaviour), but that's the definition.
>Perl mailing list
>Perl at perl.org.il
It's getting to be a little bit of nit-picking, but you contradict yourself.
In C/C++ every command need to end in semi-colon. In perl it does not.
So, it's not "exactly like C". What's more, he recommended style is to
omit it, when it's not needed (single command in block, and such).
When it is needed? when we need a way to seperate two commands.
Even removing the "just like C" part is fix enough, IMHO.
More information about the Perl