On Jun 26, Silvio Luis Leite Santana said:
>Why does code 1 work, but code 2 doesn't?
>(the diference is the ; after print)
In the first code, Perl thinks you're constructing a hash reference. In
the second code, Perl sees a block where it expects an expression.
>After all, is it posible or not to put a block
>in place of a expression?
Nope. You need to use 'do BLOCK' to turn a block into an expression.
>$bissexto = <STDIN>;
>chop($bissexto);
>$bissexto and { print "OK\n"; };
$bissexto and do { print "OK\n" };
You could use a regular if-statement here...
if ($bissexto) {
print "OK\n";
}
--
Jeff "japhy" Pinyan [EMAIL PROTECTED] http://www.pobox.com/~japhy/
I am Marillion, the wielder of Ringril, known as Hesinaur, the Winter-Sun.
Are you a Monk? http://www.perlmonks.com/ http://forums.perlguru.com/
Perl Programmer at RiskMetrics Group, Inc. http://www.riskmetrics.com/
Acacia Fraternity, Rensselaer Chapter. Brother #734
** Manning Publications, Co, is publishing my Perl Regex book **