The stupid question is the question not asked | |
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
Quick&dirty solution: Use a regualr expression to extract all the variables (assuming a form of \w+), store them in an hash along with an auto-generated variable name (eg $a,$b..). Use another regexp to replace all variables with the new names and replace the operators with the corresponding perl operator (eg s/\*/ && /g). Perform a series of nested loops, one for each variable, and eval the expression. Note that this is probably not what your teacher wants from you!
Rule One: Do not act incautiously when confronting a little bald wrinkly smiling man.
In reply to Re: Generate a truth table from input string
by psini
|
|