From: drieux <[EMAIL PROTECTED]> > On Friday, July 26, 2002, at 07:58 , Connie Chan wrote: > > And one more quick question. What are the meanings of > > "Expression" and "Block" , what are there difference ? > > an 'expression' is something that can be resolved, > > my $val = "foo"; > my $foo = 1 + $val; > my $bar = translate(@list);
If you did not include the semicolons I'd agree those are expressions. But even then I guess this would be a little misleading. While in Perl you can use those as expressions, it's not usual. These are not good examples IMHO. These are all expressions: 1 1 + 2 $x * 2 foo(1,2,3) + 49 (1,2) x 2 $x == $y $x < 5 $x > 1 && $x < 5 but even this is an expression: $x = $y + 2 Basicaly "expression" is something that creates a value that you can assign to a variable, pass to a function or use as a condition. This means that $x = $y + 2 IS an expression, but $x = $y + 2; IS NOT! It's a statement. Try if ($x = $y + 2) { print "\$y is not -2\n"; } else { print "\$y is -2\n"; } and if ($x = $y + 2;) { print "\$y is not -2\n"; } else { print "\$y is -2\n"; } Jenda =========== [EMAIL PROTECTED] == http://Jenda.Krynicky.cz ========== There is a reason for living. There must be. I've seen it somewhere. It's just that in the mess on my table ... and in my brain I can't find it. --- me -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]