Вот краткий пример, который, кажется, удовлетворит вашу проблему.
#! /usr/bin/env perl
use strict;
use warnings;
my @cond;
{
while( <> ){
chomp;
next unless length;
next if m' ^ \s* \# 'x;
next unless m' (\w+) \s* = \s* (.*?) \s* $'x;
push @cond, [$1,$2];
}
}
my($a,$b);
$a=3;
$b=5;
for my $elem ( @cond ){
my($name,$cond) = @$elem;
if( eval $cond ){
print "$name is true, because $cond matches "
}else{
print "$name is false, because $cond doesn't match "
}
print '(', eval("qq{$cond}"), ")\n";
}
echo 'condition1=$a>$b
condition2=$a<$b' | perl test.pl
condition1 is false, because $a>$b doesn't match (3>5)
condition2 is true, because $a<$b matches (3<5)