use package. example:

name the following DBString.pm:
#!/usr/bin/perl;
package DBString;
@EXPORT = qw($db $user $psw);
$db = 'db';
$user = 'user';
$psw = 'psw';
1;

then in another test script:

#!/usr/bin/perl
use DBString;
print $DBString::db,"\n"; #-- prints db
print $DBString::user,"\n"; #-- prints user
print $DBString::psw,"\n"; #- -prints psw

for more info, check out perldoc

david

Dan Fish wrote:

> 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]

Reply via email to