Returning data from an evalby Tanalis (Curate)
|on Aug 02, 2005 at 07:38 UTC||Need Help??|
Tanalis has asked for the
wisdom of the Perl Monks concerning the following question:
I'm currently working on a script to performs auto-categorisation of data elements based on rules generated from their characteristics.
These categorisation rules change periodically, and hence I've created a rules file to perform the categorisation and return a suitable category and reason to the calling sub.
My problem: I'm struggling to have eval return anything. According to the docs:
In both forms, the value returned is the value of the last expression evaluated inside the mini-program; a return statement may be also used, just as with subroutines.
.. but that doesn't seem to work for me.
A typical rule might look like the following, where $abs_diff and $source are defined within the sub performing the eval:
I've tried the following:
among a bunch of variations without luck.
Can anyone see where I'm going wrong?
Thanks in advance ...holli for pointing that out :)