Do you have a question? Post it now! No Registration Necessary. Now with pictures!
- Posted on
- Newbie: Please me define global parameters
May 5, 2005, 12:35 am
rate this thread
I want to keep some system parameters to be used by several
subroutines. So, I write in
# Column width for taskbar p columns
my $pw = "2.0mm";
Now in ptest.pl, I write
When ptest.pl is executed, all I get is,
Global symbol "$pw" requires explicit package name at ./ptest.pl line
Execution of ./ptest.pl aborted due to compilation errors.
Could you please tell me how I can define $pw in ptestdefs.pm to be
used in several other pm files?
Re: Newbie: Please me define global parameters
You shouldn't include that.
Have you seen the Posting Guidelines that are posted here frequently?
Lower case names are, by convention, reserved for pragmas.
You should choose a name with an Initial Capital.
$pw is a "lexical variable", lexical variables are *never*
visible across file boundaries, for that you need a "package variable"
our $pw = "2.0mm";
"Coping with Scoping":
Tad McClellan SGML consulting
email@example.com Perl programming
Fort Worth, Texas