Ramprasad A Padmanabhan said: > On Tue, 2004-11-02 at 13:41, Gavin Henry wrote: >> Hi all, >> >> What is the easiest way to move variable declarations out into a file in >> /etc/ and requiring a perl program to read them in at startup. If they >> are >> not there, then the program must complain. >> >> Thanks. >> > > You cannot source shell style in perl. You can write a perl file and > "require" it.
Oh, I thought you could. Not even a plain text one. Oh, well. > In order to set variables for use in your main.pl script you could > declare the variables with some scope resolution > > eg > # /etc/cfg.pl > $config::X = 12; > $config::Y = 14; > @config::cols = qw ( red green blue ); > > > # MAIN > > require "/etc/cfg.pl"; > > # You could use a local variable > my $x = $config::X; > > # Or directly use the global variable > print "X = " . $config::X; > Thanks, I'll do it like this then. > > > > #################### > HTH > Ram > > > > -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>