How can I get the command-line output of a DOS tool using Perl?

前端 未结 4 1333
挽巷
挽巷 2021-01-06 17:36

I want to meassure the throughput of a link using Windows build-in FTP tool inside a Perl script. Therefore the script creates the following command script:

         


        
4条回答
  •  逝去的感伤
    2021-01-06 17:51

    Use either open in pipe mode:

    open($filehandle, "$command|") or die "did not work: $! $?";
    while(<$filehandle>)
    {
    #do something with $_
    }
    

    or use backticks:

    my  @programoutput=`$command`
    

提交回复
热议问题