Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > declaring constants

Reply
Thread Tools

declaring constants

 
 
Troy Knight
Guest
Posts: n/a
 
      07-25-2004
This may seem like a dumb question but I've only just got back into perl
after a few years. I would be very grateful if someonme could answer this...

I'm trying to define constants which can be used across multiple source
files. This:

use constanr MY_CONSTANT => 5;

seems to only work if it's put in the main source file. How do I rectify
this so it can be used when it's defined in another source file?

Many thanks,

Troy Knight


 
Reply With Quote
 
 
 
 
nobull@mail.com
Guest
Posts: n/a
 
      07-28-2004
"Troy Knight" <(E-Mail Removed)> wrote in message news:<jLHMc.87693$(E-Mail Removed) .uk>...
> I'm trying to define constants which can be used across multiple source
> files. This:
>
> use constanr MY_CONSTANT => 5;
>
> seems to only work if it's put in the main source file. How do I rectify
> this so it can be used when it's defined in another source file?


Constants in Perl are subroutines (actually they are inlinable
subroutines).

You can export them just like any other subroutine. Typically you'd
do thois by using the Exporter module.

This newsgroup does not exist (see FAQ). Please do not start threads
here.
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Declaring constants ALuPin@web.de VHDL 5 06-02-2006 08:27 AM
Declaring constants within the scope of a class Generic Usenet Account C++ 5 03-15-2005 04:46 PM
declaring signals depending on generic parameters valentin tihomirov VHDL 1 02-18-2004 02:17 PM
Declaring ports with a complicated array type Marius Vollmer VHDL 6 12-10-2003 07:48 PM
Defining/declaring constants in Python Sriram Chadalavada Python 2 07-29-2003 11:56 AM



Advertisments