in reply to autoload - why is eval needed in this example?

*$AUTOLOAD = sub {$subs{$name}}; # This wont work! why?
goto &$AUTOLOAD;

Your $subs{$name} itself is not executable code, the value contained in it is. That's why the eval works (the code is literally placed in there, whereas the first line only makes the sub return the value).

Consider:

%subs = ( foo => sub { print "Hello, world!\n"; } ); sub AUTOLOAD { ... *$AUTOLOAD = $subs{$name}; ... }
And:
%subs = ( foo => 'print "Hello, world!\n";' ); sub AUTOLOAD { ... *$AUTOLOAD = eval "sub { $subs{$name} }" ... }

- Yes, I reinvent wheels.
- Spam: Visit eurotraQ.