These constants do not directly interpolate into double-quotish string
+s, although you may do so indirectly.
(See perlref for details about how this works.)
print "The value of PI is @{[ PI ]}.\n";
This is listed in the notes for constants.pm and I'm trying to understand the
@{[PI]} piece of this. Could someone check my understanding of this? The PI is just a subroutine call, correct, since the notes say it can also be written as PI() to obtain the result. The
[]'s are putting the return from PI() into list context and the
@{} then dereferences that? Am I anywhere close and is there an easier way to use these constant values within a set of double quotes?
20050204 Edit by castaway: Changed title from 'question about using contants'