UPDATED: added not-operator 'stops' to conditional breakup matchsub testcondition { my $work = trim($_[0]); if ($work =~ /^\((.+)\)$/) { $work = trim($1); } if ($work =~ /^(.+)\|\|(.+)$/) { my($or1,$or2) = ($1,$2); if ((testcondition($or1) eq 'T') || (testcondition($or2) eq 'T')) { return 'T'; } } elsif ($work =~ /^(.+)\&\&(.+)$/) { my ($and1, $and2) = ($1, $2); if ((testcondition($and1) eq 'T') && (testcondition($and2) eq 'T') +) { return 'T'; } } elsif ($work =~ /^(.*[^=<>])[=<>]+)([^=<>].*)$/) #updated { my ($r1, $r2, $r3) = ($1, $2, $3); if (isanumber($r1) && isanumber($r3)) { if (eval("$r1 $r2 $r3")) { return 'T'; } else { return 'F'; } } } return '?'; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: To model or not to model
by kvale (Monsignor) on Apr 14, 2005 at 18:08 UTC | |
by samizdat (Vicar) on Apr 14, 2005 at 20:06 UTC | |
|
Re: To model or not to model
by neniro (Priest) on Apr 15, 2005 at 06:50 UTC | |
by samizdat (Vicar) on Apr 15, 2005 at 12:35 UTC | |
|
Re: To model or not to model
by Velaki (Chaplain) on Apr 15, 2005 at 08:19 UTC | |
by samizdat (Vicar) on Apr 18, 2005 at 12:45 UTC |