Is there a difference between Perl's shift versus assignment from @_ for subroutine parameters?

后端 未结 9 1521
刺人心
刺人心 2020-12-14 20:16

Let us ignore for a moment Damian Conway\'s best practice of no more than three positional parameters for any given subroutine.

Is there any difference between the t

9条回答
  •  心在旅途
    2020-12-14 20:40

    I suspect if you're doing the (rough) equivalent of:

    push @bar, shift @_ for (1 :: $big_number);

    Then you're doing something wrong. I amost always use the my ($foo, $bar) = @_; form cos I've shot myself in the foot using the latter a few too many times ...

提交回复
热议问题