How to read my own configuration file in perl -
how read own configuration file .pl extension? have used require read file in script. not sure right way it? can please suggest me how this?
and when read config file require in script, errors global symbol requires explicit package name. how solve this?
here example:
this config file:
$username="sach"; $password="sach123"; $dbname="personal"; $host="localhost"; $list_old_files_file="old_files.txt"; $remove_files=1; $file_path="/sach/";
and here how call in script:
require "config.pl" ; $dbh = dbi->connect("dbi:mysql:$dbname:$host",$username,$password) or die "$dbh->errstr\n";
you can use do
command read in configuration file perl code in it.
do 'config.pl';
Comments
Post a Comment