在Perl中使用Shell命令

Shell Commands vs. Perl Clause

  • While there are some occasions that using shell commands from Perl are justified, there are many more when they are not. Decide: use the shell OR use Perl. Mixing them is to encourage inefficiency.
    This is a rough conversion table from UNIX commands to Perl. Please note that there are not always direct single equivalents, and that there are certainly many more that I can't think of (but many others will).

  • UNIXPerlOrigin
    .dobuilt-in
    awkperl ;-) (often 'split')built-in
    basenameFile::Basename::basenameBase module
    catwhile(<>){print}built-in
     ExtUtils::Command::catBase module
    cdchdirbuilt-in
    chmodchmodbuilt-in
    chownchownbuilt-in
    cpFile::CopyBase module
     ExtUtils::Command::cpBase module
    datelocaltimebuilt-in
     POSIX::strftimeBase module
    declaresee typedef
    dfFilesys::DfCPAN
    diffFile::CompareBase module
    dirnameFile::Basename::dirnameBase modules
    echoprintbuilt-in
    egrepwhile(<>){print if /re/}built-in
    evalevalbuilt-in
    execexecbuilt-in
     pipe (co-processes)built-in
     open (file descriptors)built-in
    exportAssign to %ENVHash variable
     Env::CCPAN
    findFile::FindBase module
    ftpNet::FtpBase module
    functionsubbuilt-in
    grepsee egrep
    integerintbuilt-in
    killkillbuilt-in
    ln -slinkbuilt-in
    lsglobbuilt-in
     opendir/readdir/closedirbuilt-in
     stat/lstatbuilt-in
    mkdirmkdirbuilt-in
    mkpathExtUtils::Command::mkpathBase module
    mvrenamebuilt-in
     ExtUtils::Command::mvBase module
    odordbuilt-in
     printfbuilt-in
    printprintbuilt-in
    printfprintfbuilt-in
    randrandbuilt-in
    rmunlinkbuilt-in
     ExtUtils::Command::rmBase module
    rm –fExtUtils::Command::rm_rfBase module
    seds/// (usually)built-in
    selectShell::POSIX::selectCPAN
    sleepsleepbuilt-in
     alarmbuilt-in
    sortsortbuilt-in
    sourcedobuilt-in
    tailFile::TailCPAN
    timestimesbuilt-in
    touchopen()/close()built-in
     ExtUtils::Command::touchBase module
    trap%SIGHash
     sigtrappragma
    typesetmybuilt-in
    typeset –iintbuilt-in
    typeset –llcbuilt-in
    typeset –uucbuilt-in
    typeset -Zsprintfbuilt-in

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值