[Chicago-talk] Dynamic method call

Randal L. Schwartz merlyn at stonehenge.com
Thu Nov 6 19:55:26 CST 2003

>>>>> "Steven" == Steven Lembark <lembark at jeeves.wrkhors.com> writes:

>> my $sub = $object->can( $method );
>> &$sub(@arg);
Steven>   ~~
Steven>   NO!!! The use of & to make calls is a holdover from Perl4...

No, it's still a perfectly valid thing in Perl 5.

Steven> Avoid using & for any sort of sub call unless you really
Steven> do understand what you are doing with it (at which point
Steven> you usually won't do it).

No, default to using it until you know why you shouldn't.

Note to Steven: "Prototypes are a BAD idea".

Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn at stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!

More information about the Chicago-talk mailing list