configfile.ini
--------------------------------------------------------------------------------------------------------------
[db]
user = Command Line
pass = 123
--------------------------------------------------------------------------------------------------------------
blog.pl
--------------------------------------------------------------------------------------------------------------
#!/usr/bin/perl
use strict;
use warnings;
use Config::IniFiles;
my $config = Config::IniFiles->new (-file => "configfile.ini");
my $usr = $config->val('db','user');
my $pass = $config->val('db','pass');
print "Name : $usr\tPassword : $pass\n";
--------------------------------------------------------------------------------------------------------------
Result:
perl blog.pl
Name : Command Line Password : 123
--------------------------------------------------------------------------------------------------------------
[db]
user = Command Line
pass = 123
--------------------------------------------------------------------------------------------------------------
blog.pl
--------------------------------------------------------------------------------------------------------------
#!/usr/bin/perl
use strict;
use warnings;
use Config::IniFiles;
my $config = Config::IniFiles->new (-file => "configfile.ini");
my $usr = $config->val('db','user');
my $pass = $config->val('db','pass');
print "Name : $usr\tPassword : $pass\n";
--------------------------------------------------------------------------------------------------------------
Result:
perl blog.pl
Name : Command Line Password : 123