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

I think both are the same for the efficiency.Even you could write:

my ($a,$b,$c,$d) = (shift,shift,shift,shift);

While using 'shift' has some advantage,for example, if you pass an array ref to 
a subroutine,you could access it as:

shift->[0];

or 

my @a = @{+shift};

Hope it helps.


--
Jeff Pang
NetEase AntiSpam Team
http://corp.netease.com

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