in reply to Re^14: Perl OO and accessors
in thread Perl OO and accessors
echo "'$(random)' is a random number"
If the extra ()s are too much of a burden then the logical conclusion is that everything should be a variable just to make it easy to do in string interpolation.
The principle of least surprise means that you shouldn't make something look like a variable if it's not going to behave like one. For example
MINUTES=5 echo $MINUTES # 5 SECONDS=5 echo $SECONDS # 1276
How can that be a good thing? There's not even a warning.
Also, having variables that aren't leads to run time errors that could have been caught at compile time. If random was a function, attempting to assign to it would be an error (at runtime in bash but at compile time in perl).
|
|---|