Thanks....I got this issue resolved.
One could also "resolve" the constant in a print statement like so:
use constant MAX_THRESHOLD => 99;
use constant MIN_THRESHOLD => 1;
print STDERR "ERROR 4: Command line arg <threshold> is out of range.\n";
print STDERR "ERROR 4: where <threshold> is between @{[
MIN_THRESHOLD ]} and @{[ MAX_THRESHOLD ]}.\n";
> Anthony (Tony) Esposito
> Senior Technical Consultant
> Inovis(tm), formerly Harbinger and Extricity
> 2425 N. Central Expressway, Suite 900
> Richardson, TX 75080
> (972) 643-3115
> [EMAIL PROTECTED]
>
-----Original Message-----
From: Jenda Krynicky [mailto:[EMAIL PROTECTED]
Sent: Monday, March 17, 2003 11:01 AM
To: [EMAIL PROTECTED]
Subject: Re: CONSTANTS in Perl
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]
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]