emilford has asked for the wisdom of the Perl Monks concerning the following question:
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?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";
20050204 Edit by castaway: Changed title from 'question about using contants'
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: question about using constants
by dragonchild (Archbishop) on Feb 02, 2005 at 20:13 UTC | |
by emilford (Friar) on Feb 02, 2005 at 20:23 UTC | |
by dragonchild (Archbishop) on Feb 02, 2005 at 20:24 UTC | |
by davido (Cardinal) on Feb 03, 2005 at 00:45 UTC |