我在解析命令行參數時遇到了我的perl腳本問題。主要的是,我希望perl能夠解析(em/en)-dash之前的參數以及hypen。 請考慮下面的命令執行:Perl - 在命令行參數中輸入en/em破折號
my_spript.pl -firstParam someValue –secondParam someValue2
正如你所看到的,firstParam加上前綴連字符並沒有用Perl解析它沒有問題,但secondParam的前綴是短破折號,不幸的Perl都不能認呢作爲論據。如果您使用Getopt::Long
GetOptions(
"firstParam" => \$firstParam,
"secondParam" => \$secondParam
)
你使用什麼模塊? [:: Getopt的龍(http://p3rl.org/Getopt::Long)? – choroba
@choroba,是的。我確實使用Getopt :: Long – dejvid
所有應有的尊重,這是一個瘋狂的要求。 – tripleee