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

Using SSRS2005, can you pull in values specified in the SSRS Web.Config file (think
I'm trying to deploy to a slicehost slice using this config/deploy/production.rb file. I'm clueless
I've encrypted the connectionstring in my web.config file using the steps in the link
I'm trying to create classes to read from my config file using ConfigurationSection and
I want to know which *.config file the ConfigurationManager is using. How can I
Okay, so I'm using perl to read in a file that contains some general
How can dynamic Key-value pairs of objects be stored in app.config in using the
We are currently using the log4net appender (web.config snippet): <appender name=FileAppender type=log4net.Appender.RollingFileAppender> Looking for
I'm using a program that stores its log files at C:\Windows\System32\config\systemprofile\AppData\Roaming\ProgramName\*.log , but for
I have a .net project (MySolution.Common) that uses the app.config. I am using the

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.