Dr.Ruud schreef:
> Tom Phoenix:
>> the text eval is a dangerous and powerful beast, not
>> easily tamed. Avoid avoid avoid.
>
> Ack.
>
> Do you know of a serious and safe way to use macros that are expanded
> inline?
>
> For example:
>
> lookup_table 'table', 'run_', (cat, jackalope, yeti);
>
>
"Tom Phoenix" schreef:
> the text eval is a dangerous and powerful beast, not
> easily tamed. Avoid avoid avoid.
Ack.
Do you know of a serious and safe way to use macros that are expanded
inline?
For example:
lookup_table 'table', 'run_', (cat, jackalope, yeti);
would expand to:
my %ta
On 4/3/06, Dr.Ruud <[EMAIL PROTECTED]> wrote:
> my %table;
> eval '$table{' . $_ . '} = \&' . $_
>for qw(cat jackalope yeti);
myeyesmyeyesthegogglesdoNOTHING
When I posted my code, I said that I wrote it that way to avoid using
"the dreaded soft reference". But using a soft reference is far
"Tom Phoenix" schreef:
> my %table = (
> cat => \&cat,
> jackalope => \&jackalope,
> yeti => \&yeti,
> );
An alternative is to build that with eval:
my %table;
eval '$table{' . $_ . '} = \&' . $_
for qw(cat jackalope yeti);
--
Affijn, Ruud
"Gewoon is een t
On Mon, 2006-03-04 at 15:41 -0500, The Ghost wrote:
> based upon the string in a variable, I want to run a particular
> subroutine:
>
> my $var='cat';
>
>
>
> $var='fish';
>
> &$var; # I want to run fish if $var is a fish or cat if $var is a cat...
>
> sub cat { };
> sub do
On 4/3/06, The Ghost <[EMAIL PROTECTED]> wrote:
> based upon the string in a variable, I want to run a particular
> subroutine:
One way to do this (without the dreaded soft reference) is to have a
lookup table:
my %table = (
cat => \&cat,
jackalope => \&jackalope,
yet