On 3/18/06, tom arnall <[EMAIL PROTECTED]> wrote:

> under 'use strict', how do you assign a value to a constant used only in a
> subroutine, without doing the assignment with every execution of the sub',
> and without making the constant a global variable. by constant i mean a
> variable which never changes value throughout the script.

I think you're talking about something like this, which uses a
variable whose scope is a BEGIN block:

    BEGIN {    # BEGIN block provides scope
        my $steady = 42;    # assigned at compile time
        sub whatever {
            return "The answer is $steady.\n";
        }
    }

Hope this helps!

--Tom Phoenix
Stonehenge Perl Training

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to