penantes has asked for the wisdom of the Perl Monks concerning the following question:
$Threscount=0; open(THRESHOLDS, "$Thresholds") or die("Could not open Thresholds file +."); foreach (<THRESHOLDS>) { chomp($_); if ($_ =~/^(\w+);(\d+);$/ && $_ !~/^\#/) { print "DEBUG: use constant $1 => $2;\n"; use constant $1 => $2; log_msg("Setting: use constant $1 => $2;"); if ($Threslabels[$Threscount] ne $1) { log_msg("There is something wrong with the thresholds labels, check + thresholds file!"); exit(2); } $Threscount++; } } if ($Threscount != 8) { print "$Threscount\n"; log_msg("Wrong number of thresholds they should be 8 there are $Thres +count"); exit(2); } close(THRESHOLDS);
#Define Warning values use constant SIMULWAR => 30; use constant MEMINUSEWAR => 200000000; use constant SIMULSNAGWWAR => 40; use constant CONDBWAR => 200; #Define Critical Values use constant SIMULCRIT => 50; use constant MEMINUSECRIT => 240000000; use constant SIMULSNAGWCRIT => 60; use constant CONDBCRIT => 240;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Define constant in loop
by artist (Parson) on Feb 23, 2005 at 16:23 UTC | |
by penantes (Acolyte) on Feb 23, 2005 at 16:34 UTC | |
|
Re: Define constant in loop
by dragonchild (Archbishop) on Feb 23, 2005 at 18:04 UTC | |
|
Re: Define constant in loop
by TedYoung (Deacon) on Feb 23, 2005 at 16:34 UTC | |
|
Re: Define constant in loop
by Tanktalus (Canon) on Feb 23, 2005 at 17:58 UTC |