I learnt something about this for days only, so don't
know if there are bugs here :

# Create a package glob_vars.pm #
package glob_vars;
require Exporter;
our @ISA = qw (Exporter);
our @EXPORT = qw (%VARS)
our %VARS = ();

$VARS{sth_a} = 'sth_a';
$VARS{sth_b} = 'sth_b';

1;
# End of package #


# A Code #

#! perl
use strict;
use glob_vars;

print $VARS{sth_a}; # sth_a

# End Code #


This example was not tested, but the idea is like this...

Rgds,
Connie






----- Original Message ----- 
From: "Dan Fish" <[EMAIL PROTECTED]>
To: "Perl List" <[EMAIL PROTECTED]>
Sent: Wednesday, August 21, 2002 6:34 AM
Subject: Global variables


> What would be the preferred method of creating global variables that can be
> used in several different cgi scripts.  For example, I'd like to create the
> variables $database, $user, $pass that I only have to change in one place,
> but can use in many different scripts.
> 
> In C of course I'd just use #INCLUDE, but I'm not very "perliterate"
> (yet)...:-)
> 
> Thanks,
> -Dan
> ---
> "Old programmers never die... Unless of course they refuse to accept a few
> extra CPU cycles over months of efficiency tuning... [Have times changed or
> WHAT!]"
> 
> 
> -- 
> 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]

Reply via email to