in reply to Re^2: question about using constants
in thread question about using constants
It really falls under the category of one of those things that is possible but not all that advisable.
Just because it's possible to say, "Let's interpolate a function: @{[PI]}\n";, I'm not convinced that it's in any way clearer than: "Lets not interpolate: " . PI . "\n";
In the first example the double-quoted string is parsed for interpolation components. The @{...} is found, and that tells Perl you want to interpolate a reference to an array. And the [....] creates that reference, based on the "...." expression.
In the second example, you start with a string, concatenate the evaluated expression, and concatenate a newline character. Much simpler, and less work.
Dave
|
|---|