我是perl的新手,試圖在一個簡單的perl腳本中運行下面的高級gam命令,但無論我使用什么,它都不會將輸出列印到螢屏上 - 我做錯了什么?
uj5u.com熱心網友回復: 你應該總是以 對于這段特定的代碼,可能只是你的字串中的 uj5u.com熱心網友回復: 下面的代碼片段演示了你應該如何在perl中使用 請看。system, Quote and Quote-like Operators
標籤:#!/usr/bin/perl。
#exec ("ls -l");
chdir '/home/ted/bin/gamadv-xtd3'/span>;
#exec ("gam user [email protected] show contacts emailmatchpattern [email protected] fields email");
#system "gam user [email protected] show contacts emailmatchpattern [email protected] fields email";
exec ("gam user [email protected] show contacts emailmatchpattern [email protected] fields email") 。
use strict;和use warnings;開始你的程式。這將捕獲并報告你的代碼中的許多問題。
@co插值失敗了(導致gam命令失敗)。或者可能是gam不在你的路徑上,所以exec本身失敗了。
system()呼叫。span class="hljs-keyword">use strict;
use warnings;
my $cmd = $ENV{HOME} . '/bin/gamadv-xtd3';
my @args = qw/gam user [email protected] show contacts emailmatchpattern [email protected] fields email/;
system($cdm,@args)。
