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

后端 未结 9 1481
刺人心
刺人心 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:41

    I prefer

    sub factorial{
      my($n) = @_;
    
      ...
    
    }
    

    For the simple reason that Komodo will then be able to tell me what the arguments are, when I go to use it.

提交回复
热议问题