我正在使用perl程序(perl 5.8)。該程序爲其輸入使用命令行參數。 我面臨的問題是這個 - 我使用多個命令行參數。 例如當一個參數錯誤地將其他參數作爲其值時,perl中的多個命令行參數
tool -f "arg1_val" -p "arg2_val"
但在情況下,當用戶忘記指定值說
tool -f -p "arg2_val"
而是示數出來的,它假定-f -p =
我使用Getopt::Long和日常GetOptions
GetOptions ("f=s" => \$opt_f,
"p=s" => \$opt_p,
);
一個不錯的[關於Getopt :: Long的文章](http://perltricks.com/article/195/2015/10/21/Professional-scripts-are-a-snap-with-Getopt--長/)。 – jreisinger