Hi Nora,

On Monday 16 August 2010 10:31:48 HACKER Nora wrote:
> Hi list,
> 
> I just implemented multiple statements after 'or' but it wouldn't work
> unless I put the semicolon after the closing bracket. Am I right guessing
> that the trailing semicolon ends the statement at the beginning and is
> therefore invariably needed?

Yes, you're right. An «EXPR() or do { ... };» statement is a normal statement, 
not a construct like «if (! EXPR()) { .... }» which does not require a 
trailing semicolon.

> 
> #!/usr/bin/perl -w
> use strict;
> use warnings;
> 
> chown 204, 202, 'test.txt' or do {
>         warn "FEHLER!\n";
>         warn "chown nicht möglich: $!\n";
> };

Please consider using if here instead. Also, you should only warn once with 
the complete warning.

Regards,

        Shlomi Fish

> 
> chmod 0775, 'test.txt' or do {
>         warn "FEHLER!\n";
>         warn "chmod nicht möglich: $!\n";
> };
> 
> Kind regards,
> Nora

-- 
-----------------------------------------------------------------
Shlomi Fish       http://www.shlomifish.org/
http://www.shlomifish.org/humour/ways_to_do_it.html

God considered inflicting XSLT as the tenth plague of Egypt, but then
decided against it because he thought it would be too evil.

Please reply to list if it's a mailing list post - http://shlom.in/reply .

--
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
http://learn.perl.org/


Reply via email to