in reply to function inline evaluation (formated *gg*)
You have a couple of problems, first you need to have the () around the the sub. The second problem is that you just have a variable for your sub. Below is two ways to make this work.
Remember that you are actually writing a sub (pretend it isn't in double quotes), so if you want to run a piece of code that is in $funk, you need to eval it.use posix;# $i=3; $funk = "cos($i)"; # We eval $funk print "Das ist ${\(eval $funk)}"; # We write out our sub here print "Das ist ${\(cos($i))}";
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: function inline evaluation (formated *gg*)
by mr.nick (Chaplain) on Jan 24, 2001 at 19:38 UTC |