Welcome to the Monastery | |
PerlMonks |
using evalby Anonymous Monk |
on May 25, 2004 at 23:59 UTC ( [id://356417]=perlquestion: print w/replies, xml ) | Need Help?? |
Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
Ok, I’m an extreme newb, I don’t use my Perl projects on a server for anyone other then myself and I honestly usually just get by with my "while" and "if" statements However, I’ve run into a problem that if and while statements would be very messy at. say I have a variable like $foobar and $foobar holds x^4-3 or even x+3 I’m wondering if there’s a way I can have Perl evaluate this and give me the result... I think it has to do with the eval function but I tried this simple code and it didn’t work... the result is 4+3=4+3... not exactly what I need... Any and all help would be greatly appreciated, also I need it to do it using bedmas, I don’t know if it does by default or not Edit by castaway added code tags
Back to
Seekers of Perl Wisdom
|
|