in reply to Re: Re: How to use eval?
in thread How to use eval?
#eval $code; print $code;
You might be surprised at the value of $code.
I'm sure you already know this, but I'll repeat it anyway - double quotes interpolate contained variables, single quotes do not. perl is trying to eval if ($port_a $cmp_op $port_b)... which is destined to fail - it won't even compile. In order to evaluate it properly, $code needs to to contain if ($port_a < $port_b)....
I'll leave it for you to construct the string properly ;) Once you do, comment the print and uncomment the eval.
BTW, what are you trying to accomplish? Could there be a better way?
Update: BTW, I didn't see your update until after posting this node. I assume most would see it easier if you posted a response instead the update.
Update #2 Update #1 is directed at the OP, not xenchu
|
|---|