in reply to Re: AUTOLOAD - the good, the bad, and the ugly
in thread AUTOLOAD - the good, the bad, and the ugly

A nit.
my $method = $method_and_structure[@method_and_structure-1];
is better written (and slightly faster) as
my $method = $method_and_structure[-1];

But, most examples I've seen tend to do the one of the following:

my $method = (split '::', $AUTOLOAD)[-1]; #### my ($method) = $AUTOLOAD =~ /([^:]+)$/; #### (my $method = $AUTOLOAD) =~ s/.*:://;

In that last, you want to use .* as opposed to .*? because you want it to be as greedy as possible.

Update: Fixed slice to scalar access.

Update: Added parentheses in second-to-last example.

Being right, does not endow the right to be rude; politeness costs nothing.
Being unknowing, is not the same as being stupid.
Expressing a contrary opinion, whether to the individual or the group, is more often a sign of deeper thought than of cantankerous belligerence.
Do not mistake your goals as the only goals; your opinion as the only opinion; your confidence as correctness. Saying you know better is not the same as explaining you know better.

Replies are listed 'Best First'.
Re^3: AUTOLOAD - the good, the bad, and the ugly
by ihb (Deacon) on May 05, 2005 at 00:29 UTC

    I tend to do my ($method) = $AUTOLOAD =~ /.*::(.*)/s; which I find nice and clean.

    ihb

    See perltoc if you don't know which perldoc to read!