On 11/20/07, Jo for Groups and Lists <[EMAIL PROTECTED]> wrote:
> Is there a way to store and retrieve code for conditions and actions in
> a chart? Something like
>
> Condition action
> $Pet eq "dog" $suggest.="Buy a Bone?"
> $numBiscuits >1 $subTotal+=($numBiscuits*2.00)
You've got a start. It looks as if the piece you're missing is the
coderef: a reference to a chunk of code. You should be able to do what
you want by using references to anonymous subroutines, maybe something
like this:
my $coderef = sub { my($pet) = shift; return $pet eq "dog" };
You can read about anonymous subroutines in the perlref manpage.
http://perldoc.perl.org/perlref.html
Hope this helps!
--Tom Phoenix
Stonehenge Perl Training
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/