Next | Tricks of the Wizards | 97 |
@funcs = qw(red yellow blue);
sub red { ... } sub yellow { ... } sub blue { ... }
sub AUTOLOAD { die "Function $AUTOLOAD unknown; try [@funcs]\n"; }
Now if you do
green(...);
You get this:
Function main::green unknown; try [red yellow blue]
The name of the would-be function is placed in $AUTOLOAD
Next | Copyright © 2003 M. J. Dominus |