>>>>> "Daniel" == Daniel Staal <[EMAIL PROTECTED]> writes:

Daniel> The difference with using shift or assigning it directly is shift
Daniel> removes the value from the array, assigning it directly does not. This
Daniel> may not make much difference, but occasionally it does.

I generally prefer shift:

1) it gets the method-call parameter out of the way:

        my $self = shift; # instance methods

or

        my $class = shift; # class methods

or

        my $either = shift; # rare instance/class methods that check ref($either)

2) I can put docs for each parameter by each variable:

        my $self = shift;
        my $from = shift; # source address, usually a string
        my $to = shift; # destination address, can be an IO::Socket
        my (@args) = @_; # what to send

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<[EMAIL PROTECTED]> <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!

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to