[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [MacPerl-AnyPerl] constants



At 10.40 +0000 2000.05.20, Joel Rees wrote:
>Does Perl support constants such as C's
>     const myCompilerController = 0x68040
>or
>     #define myCompilerController 0x68040
>?
>
>What I want is the assurance that I can't change the value of
>myCompilerController by accident.

Use the constant module.

  use constant FOO => 'BAR';

What this does is define a subroutine that returns a given value.  It is
still _possible_ to change it, but can be difficult.

-- 
Chris Nandor       |     pudge@pobox.com      |     http://pudge.net/
Andover.Net        | chris.nandor@andover.net | http://slashcode.com/

==== Want to unsubscribe from this list?
==== Send mail with body "unsubscribe" to macperl-anyperl-request@macperl.org