in reply to Re: Naming Subs
in thread Naming Subs
Of course you'd want to catch actions that haven't been defined; you could do that by comparing $action against a hash of defined actions, or eval'ing the above statement, or, well, you know how it goes ;)
No need for any of that. If you used a hash, you would need to verify that the element existed using exists. As pointed out elsewhere in thread, the symbol table is just a glorified hash anyway, and you can check for the existance of the action in exactly the same way
$data = &{ $action } if exists &{ $action };
Examine what is said, not who speaks.
The 7th Rule of perl club is -- pearl clubs are easily damaged. Use a diamond club instead.
|
|---|