Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4330770
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T10:00:33+00:00 2026-05-21T10:00:33+00:00

I am using the Config::Simple module and the constant pragma. I am parsing a

  • 0

I am using the Config::Simple module and the constant pragma. I am parsing a configuration file and setting the values as constant. the test configuration file (test.ini) contains:

POP3SERVER='192.168.1.1'

when I am running the follow perl statements:

use warnings;
use strict;

use Config::Simple;
my %Cnf;
Config::Simple->import_from('test.ini', \%Cnf);
use constant TEST => scalar $Cnf{"default.POP3SERVER"};
print $Cnf{"default.POP3SERVER"},"\n";
print TEST . "\n";

I get the following lines:

192.168.1.1
Use of uninitialized value in concatenation (.) or string at ./algo.pl line 10.

The hash contains the information, you can see it in the first print but when assigned in the constant statement is not set

What am I doing wrong on the code??

thnx

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-21T10:00:34+00:00Added an answer on May 21, 2026 at 10:00 am

    “use” happens at compile time, calling import_from() happens at run time (ie after the use).

    Wrap the call to import_from in a BEGIN block:

    my %Cnf;
    BEGIN {
        Config::Simple->import_from('test.ini', \%Cnf);
    }
    use constant TEST => scalar $Cnf{"default.POP3SERVER"};
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to test using a TimedRotatingFileHandler with a logging.config file, nothing that complicated
Using the ConfigParser module I am attempting to read in a configuration file so
I am using the config-file package in Ocaml. It looks like it should be
in an application I'm using a config-file in which i'd like also to use
I have a python class which reads a config file using ConfigParser: Config file:
How do I read connection strings from custom config file (say abc.config) using WebConfigurationManager
I'm using an XML config file to populate my navigation using Zend_Navigation. I have
How can I change the connection string from nhibernate.config file using nant the problem
Okay, so I'm using perl to read in a file that contains some general
So I know how to setup a cron using the config.xml crontab stuff: <crontab>

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.