The content of condition.conf
:
condition1=$a>$b
Example Perl code:
$cnd_ConfFile = $ARGV[0];
open(CONDITIONS, '<', $cndConfFile);
$cndCount=0;
while ( <CONDITIONS> ) {
chomp; # no newline
s/#.*//; # no comments
s/^\s+//; # no leading white
s/\s+$//; # no trailing white
next unless length;
($var, $value) = split(/\s*=\s*/, $_, 2);
$cndOnCounterValues[$cndCount++]=$value;
}
close CONDITIONS;
$cond = $cndOnCounterValues[0];
print "\n$cond\n";
$a=3;
$b=5;
if($cond){
print "a is greater then b";
}
else
{
print "b is greater then a";
}
The above code always gives the output "a is greater then b
".
Regardless of the values of $a
and $b
.