美文网首页
子函数引用(functions ref.ed)

子函数引用(functions ref.ed)

作者: 余绕 | 来源:发表于2020-04-20 17:00 被阅读0次

    ############不引用子函数################

    @a=("A","b","c");
    @b=("D","E","F");
    
    sub pritncontent{
    
    my(@letter1,@letter2)=@_;
    
    print "@letter1\n";
    print "@letter2\n";
    }
    
    &pritncontent(@a,@b);
    

    ###############引用子函数#####################

    @a=("A","b","c");
    @b=("D","E","F");
    
    sub pritncontent{
    
    my($letter1,$letter2)=@_; #引用后这里必须是$作为引用
    
    print "@$letter1\n";
    print "@$letter2\n";
    }
    
    &pritncontent(\@a,\@b);
    

    相关文章

      网友评论

          本文标题:子函数引用(functions ref.ed)

          本文链接:https://www.haomeiwen.com/subject/qfodihtx.html