When I run perl -c myscript.cgi to test the syntax or perl -w ..., it produces this: 
Too late for "-T" option at maintenance.cgi line 1 (my line 1 is just the shebang line 
with the -T option). Does this mean that something is wrong?
-Rob
  Carl Franks <[EMAIL PROTECTED]> wrote: Hi,
This is how I do it.

#!/usr/bin/perl -wT
use strict;
my $conf;

unless ($conf = do ('/path/to/config.pl')) {
die ("Could not open file");
}

print $conf->{'var1'}, "\n";

-----

Then in a file called "config.pl"


{
var1 => "one",
var2 => "two"
}

-----

The "unless" part is just to check that the file was opened successfully.
The "do" actually opens the file and assigns the hash structure to $conf.

Hope this helps!
Carl

> Hi all,
>
> I want to use:
>
> use strict;
>
> And I want to use a configuration file in a Perl script.
> The configuration file uses:
> %page1=(
> ....
> );
>
> %page2=(
> ....
> );
>
> This way I get errors if I run the script because the variables are not
> defined with "my".
>
> I've tried putting in the configuration file:
>
> my %page1=(
> ....
> );
>
> But this method doesn't work.
>
> I use a configuration file and I would like to put the settings only in this
> file without modifying the script.
>
> Is it possible?
>
> Thanks.
>
> Teddy,
> [EMAIL PROTECTED]
>
>


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



---------------------------------
Do You Yahoo!?
Yahoo! - Official partner of 2002 FIFA World Cup

Reply via email to