in reply to Re: shift vs @_
in thread shift vs @_
Now if you just mean why not always use the my( $a, $b, $c ) = @_; form vice shift: there's times when you want to pull off some items and then do something list-y with the remaining contents of @_. Best example off the top of my head would be something that builds a hash from key/value pairs like:
Another good example is subclassing...
sub do_something { my $self = shift; $self->SUPER::do_something( @_ ); # do some more stuff }
We're not surrounded, we're in a target-rich environment! |
---|
|
---|
In Section
Seekers of Perl Wisdom