Hello List,

I was wondering when it is appropriate to do multiple shifts on parameters passed to a subroutine and when it is appropriate to just feed it @_.

For example, you have:

&fancy_sub($a, $b, $c, @d);

Is it better (I'm leaving this term vague on purpose) to write:

sub fancy_sub {
    my($a, $b, $c, @d) = @_;
    ...do some fancy stuff...
}

or

sub fancy_sub {
    my $a = shift;
    my $b = shift;
    my $c = shift;
    my @d = @_;
   ...do some fancy stuff...
}

Obviously the latter requires more typing, but is there any kind of optimization for choosing to write it this way?

Thanks,
Adam

--
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