Calling perl subroutines from the command line

前端 未结 5 1366
情深已故
情深已故 2020-12-18 04:13

Ok so i was wondering how i would go about calling a perl subroutine from the command line. So if my program is Called test, and the subroutine is called fields i would lik

5条回答
  •  执念已碎
    2020-12-18 05:16

    here is an example:

    [root@mat ~]# cat b.pm 
    #!/usr/bin/perl
    #
    #
    sub blah {
        print "Ahhh\n";
    }
    return 1
    [root@mat ~]# perl -Mb -e "blah";
    Ahhh
    

提交回复
热议问题