Clear questions and runnable code get the best and fastest answer |
|
PerlMonks |
Re: What is the difference between a Statement and an Expression?by Boots111 (Hermit) |
on Aug 02, 2001 at 17:41 UTC ( [id://101645]=note: print w/replies, xml ) | Need Help?? |
It seems like all of the answers drive at a fundamental difference. Expressions do something, while statement do not (always) do something. Thus a quick and dirty answer would be that an expression is anything typically followed by a ; If, else, while, and for do not usually have a ; after them because they just determine when (and how often) the assossiated expression is evaluated. If is improtant to note that any expression with a return value can be used as a statement. For example $x = $y; is an expression; however, it is used as the statement part of the expression $z = ($x = $y); (the parentheses are just there for clarity). Hope that helps, Matt
In Section
Seekers of Perl Wisdom
|
|