is better written (and slightly faster) asmy $method = $method_and_structure[@method_and_structure-1];
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.
In reply to Re^2: AUTOLOAD - the good, the bad, and the ugly
by dragonchild
in thread AUTOLOAD - the good, the bad, and the ugly
by shemp
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |