Perl Subroutine Prototyping — The correct way to do it

后端 未结 5 1312
滥情空心
滥情空心 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条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-12-10 07:05

    Just get rid of prototypes altogether:

    sub debug;
    
    debug "Here I am! And the value of foo is $foo";
    debug "I am in subroutine foo", 3;
    
    sub debug {
        # body of debug
    }
    

提交回复
热议问题