Perl Subroutine Prototyping — The correct way to do it

后端 未结 5 1315
滥情空心
滥情空心 2020-12-10 06:48

I have a subroutine called debug I use in my code. It basically allows me to see what\'s going on, etc.

sub debug {
    my $message      = shift         


        
5条回答
  •  萌比男神i
    2020-12-10 07:05

    You have to declare the same prototype when you define your subroutine:

    sub debug($;$); # prototype/declare
    
    ... meat of the program ...
    
    sub debug($;$) {
        ...
    }
    

提交回复
热议问题