誰能告訴我爲什麼我得到這樣的:Perl的用法錯誤
usage: gen-non-random.pl <count> <outputfile>
從下面的代碼: #在/ usr/bin中/ perl的-w # #腳本生成非隨機值,以演示一個糟糕的隨機性圖 #爲我的「如何分析SessionIDs」。 # #寫的:
$version = "0.0.4";
$filename = "gen-non-random.pl";
$usage = "usage: $filename <count> <outputfile>\n";
$count = $ARGV[0] or die ("$usage\n");
$output = $ARGV[1] or die ("$usage\n");
print ("-- $filename Version: $version\n");
use Time::HiRes qw(usleep ualarm gettimeofday tv_interval);
use Math::Random;
use Digest::MD5 qw(md5_hex);
open (OUT, ">$output") or die ("Can't open $output\n");
for ($i=0; $i<$count;$i++)
{
# generate a random number
$random = random_uniform();
# cut out char 3-9 of $random and put it in $randsub
$randsub = substr($random, 2, 6);
# get seconds and microseconds since epoch
($seconds, $microseconds) = gettimeofday;
# get the last two chars of the seconds and put them into $s
$s = substr($seconds, 8, 2);
# sleep for a while
usleep $randsub;
# put together the last two digits of seconds and the microseconds
$time = $s . $microseconds;
$md5_time=md5_hex($time);
# print out the stuff we put together above
print OUT ("$md5_time\n");
}
close (OUT) or die ("Can't close $output\n");
print ("$count values written to $output\n");
exit;
我是新來編程,所以我需要非常簡單的答案,請!我沒有擁有我在大學研究論文中使用的代碼。另外,有人請向我解釋什麼用法實際上是我似乎無法找到一個很好的解釋呢? 謝謝。
這是你昨天問過的完全相同的問題(儘管你似乎已經刪除了它)。兩個人在評論中解釋了爲什麼你會得到這個錯誤。你不瞭解他們的解釋嗎? – ThisSuitIsBlackNot
只是爲了好的衡量:這意味着腳本需要兩個參數,一個整數和一個輸出文件名。要運行它,請執行以下操作:'gen-non-random.pl 10 output.txt' – ThisSuitIsBlackNot
http://stackoverflow.com/q/21443286/223226 –