What's your opinion on the use of shift? Some have mentioned that during a code review, you can lose points for using it to extract function parameters. Others seem to be utterly infatuated with it, perhaps even to the point of perversion. No matter how useful I find it, there are still things that bother me, if only psychologically:
sub foo { return shift()->{foo}; }
Seems only a few operators away from fully-fledged obfuscation, but it works, no? That's the annoying part. The other annoying part is how well it works.

Out of the following, which one is the fastest?
package Foo; sub with_shift { my $self = shift; return $self->{foo}; } sub with_inline_shift { return shift()->{foo}; } sub with_index { return $_[0]->{foo}; } sub with_list { my ($self) = @_; return $self->{foo}; }
Ideally, which is a euphemism for "in that place where all is well and good, but you can't get there from here", the named parameter method would be the fastest. Unfortunately, this is just not the case. with_inline_shift() is always the fastest, regardless of the number of parameters passed. In fact, it is about 30% faster with one parameter, and at least 10% faster when loaded with 1000 parameters.

The performance curve of with_inline_shift is very similar to that of with_index, presumably because both of them have no local variables to declare. The other two, with_list and with_shift are similarly slower. my is pretty darned expensive, don't you think?

Is this a case of "nice guys finish last" or what?