As you would see below is a bad perl practice of 'eval' a scalar containing code. That aside, in the following code, the condition '$condition{'b'}{'1'}' was not run through the loop. Only the condition that came first in the array ran, ie. condition '$condition{'a'}{'1'}', was run.
my @parameter=('a','b');
my %condition;
$condition{'a'}{'1'}='$degree>=5';
$condition{'b'}{'1'}='$number>5';
foreach (@parameter) {
my $count=0;
foreach (<INPUT>) {
my $degree=....; #$degree defined
my $number=.....; #$number defined
if (eval $condition{$_}{'1'}) {$count++} #only $condition{'a'}{'1'} was run!
}
}
The first question is why did the first condition got stuck in the loop and the second question is how can I fix it? Would really appreciate any help/advise/solutions. :)