--- Silvio Luis Leite Santana <[EMAIL PROTECTED]> wrote:
> Please
> Why does code 1 work, but code 2 doesn't?
> (the diference is the ; after print)
> After all, is it posible or not to put a block
> in place of a expression?
> Thanks in advance
> Silvio
> 
> CODE 1 - WORK 
> 
> $bissexto = <STDIN>;
> chop($bissexto);
> $bissexto and { print "OK\n" };
> print "end\n";
> 
> 
> CODE 2 - DOESN'T WORK
> (should it work, I'd wish to put more
> than one command inside the curly braces)
> 
> $bissexto = <STDIN>;
> chop($bissexto);
> $bissexto and { print "OK\n"; };
> print "end\n";


Am I being dense? I don't see the difference.
I would, however, recode for better stability and readability:

 chomp($bissexto = <STDIN>); # not chop.... c.f. perldoc -f for each
 if ($bissexto) {
    print "OK\n"; # you can put as many lines as you like here
 };
 print "end\n";


__________________________________________________
Do You Yahoo!?
Get personalized email addresses from Yahoo! Mail
http://personal.mail.yahoo.com/

Reply via email to