Calling perl subroutines from the command line

前端 未结 5 1409
情深已故
情深已故 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:11

    You can't do that unless the subroutine is a built-in Perl operator, like sqrt for instance, when you could write

    perl -e "print sqrt(2)"
    

    or if it is provided by an installed module, say List::Util, like this

    perl -MList::Util=shuffle -e "print shuffle 'A' .. 'Z'"
    

提交回复
热议问题