Regarding requests for suggestions to improve your code's
robustness...
My guess is that you are probably not using the strictures, since $config_file is not declared with my (at least, not in your sub):
use warnings;
use strict;
When accessing an environment variable, it is a good practice to test if it is defined. If it is not defined, you could either die (as shown below), or assign it a default value:
my $config_file = (defined $ENV{'CONFPATH'}) ?
$ENV{'CONFPATH'} :
die "Error: CONFPATH not defined.\n";
Should <CFILE> really be <CONFFILE>?
It is also a good practice to close a filehandle
when you are done.
These tips probably do not solve your specific problem, but hopefully they are small steps toward more robust code.
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.