Hi -

Perl is not like a typical compiled language, for example, c/c++.
It really doesn't have the typical 'include' functionality.
The 'use' and 'require' keywords are for 'including' perl
modules (normally with the .pm suffix) that reside in the
@INC path (type 'perl -V' to see your @INC path). Modules
normally are 'packages' that are coded to address a particular
programming tasks not native to the perl core. You probally are
not looking to code a module for you purposes.

One way I have used to accomplish something similar to what you
are trying to do is to code a 'configuration' file that returns
a hash reference:

{
  model => "blah, blah, blah...",
  color => "red",
  serial_number => 8997234,
};

and then involk the configuration using the string
form to eval:

  my $options;
  open CONF, "conf.file" or die "...',
  {
    undef $/; # slurp the file
    my $data = <CONF>;
    $options = eval $data;
    $@ && die "syntax error...";
    close CONF;   
  }

  print "$options->{model}\n";
  print "$options->{color}\n";
  print "$options->{serial_number}\n";

Aloha => Beau.

-----Original Message-----
From: Jens Irrgang [mailto:[EMAIL PROTECTED]]
Sent: Sunday, December 01, 2002 2:58 AM
To: [EMAIL PROTECTED]
Subject: Var's in extern file 


Hello,

I'm writing a script (what a surprise).
I want to use an extern file to store my variables. Like a config-file.
But with -use strict- it doesn't work. 

I've tried it with use and require. But I get always this error-message:
Global symbol "$nummern" requires explicit package name at
d:\homepage\homepage\tier-vermisst\cgi-bin\jiforum.pl

Ok - I know that I have to declare it with my - but I don't want to
declare all the var's used in the configfile in the main script. Is
there a way to declare the var's in the config-file?

Tia

Jens



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