my %conf; ## Read command-line arguments (overrides config-file) use Getopt::Long qw(:config bundling); GetOptions( 'verbose|v!' => \$conf{'verbose'}, 'color!' => \$conf{'colour'}, 'server|s=s' => \$conf{'server'}, 'channel|c=s' => \$conf{'channel'}, 'nick|n=s' => \$conf{'nick'}, 'name|a=s' => \$conf{'name'}, 'username|u=s' => \$conf{'username'}, 'port|p=i' => \$conf{'port'}, 'nspasswd|P=s' => \$conf{'nspasswd'}, 'silent!' => \$conf{'silent'}, 'debug|d!' => \$conf{'debug'}, 'dbfile|D=s' => \$conf{'dbfile'}, 'version|V' => \&version, 'help|h|?' => sub { usage(0) } ) or die( usage(1) ); print Dumper(%conf); foreach (keys %conf) { $config->set($_, $conf{$_}) if (defined $conf{$_}); }