From: Tony Esposito <[EMAIL PROTECTED]>
> In C, you can define a constants - "variables" whose contents can not
> be changed. Is there any way to do this in Perl? There are some
> variables I use that I would love to set as a constant.
In case you really wanted them to be variables you may do this:
*Pi = \3.1415927;
print "The area is:", $Pi * $r**2, "\n";
$Pi = 3;
# -> Modification of a read-only value attempted ...
But the more common (and more efficient) way is
use constant Pi => 3.1415927;
print "The area is:", Pi * $r**2, "\n";
Jenda
===== [EMAIL PROTECTED] === http://Jenda.Krynicky.cz =====
When it comes to wine, women and song, wizards are allowed
to get drunk and croon as much as they like.
-- Terry Pratchett in Sourcery
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]