"be consistent" | |
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
I can understand why you are confused. Here is my attempt to add light to darkness.. :)
expression is just a way to calculate a value, using operators, build-in or your own functions.
And now, IMO what confuses you: sometimes statement might have a value like expression has, and statement can be used also as expression sometimes. Simple example: Here $line = <> is used as statement (reading a line from STDIN) and also as expression (returning value assigned to $line. String is TRUE if something (not undef) was read in, and undef is returned when End_Of_File was reached. It might be confusing for beginners, but it is extremely convenient. You'll find many idioms like this, Larry Wall (inventor of perl) made perl so flexible, there is even abbreviation for that: TIMTOWTDI - There Is More Than One Way To Do It. Perl tries to help you. Just always use strict and use -w switch, everything else will come along. Your experience will grow, and your fun using perl will follow. Welcome in monastery, and come again. There is lot of information for you around. I gave you ++ for noticing the difference. pmas In reply to Re: What is the difference between a Statement and an Expression?
by pmas
|
|