Perl Config file

Use Perl's parser to write config files. If your projecy is MyApp, create config file in MyApp/Config.pm

%MyApp::Config = (
    email => 'support@example.com',
    file  => '/path/to/file.txt'
    # other parameters
);

Include use MyApp::Config; and the variables can be accessed in the hash as:-

$MyApp::Config{email}
$MyApp::Config{file}

Perl will syntax check this and give an error if there's an error.

 
perl/configfile.txt · Last modified: 28/12/2023 13:08 by andrew