in reply to How ti include a file in Perl script

You can use do, as was already suggested in the CB.

But perhaps a better approach is a module for configuration files, like Config::Tiny or YAML::Tiny.

  • Comment on Re: How ti include a file in Perl script

Replies are listed 'Best First'.
Re^2: How ti include a file in Perl script
by bart (Canon) on Jan 10, 2008 at 12:28 UTC
    You can use do, as was already suggested in the CB.
    Or require, or even use. See perlmod for a discussion.

    Don't forget to use a true value (like 1) as the last statement executed in the file. And you may have to change the file's name so it ends in ".pm" instead of in ".pl".

    Be careful, you're using a Perl4 approach, it might sting you in the back if you try to require a file more than once, but from different packages.