0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

【質問】perlのGetopt::Longで、先頭が-(ハイフン)で始まる文字列を受け取る方法

Last updated at Posted at 2015-09-30

質問エントリです。誰か教えて...

perlのGetopt::Longで、先頭が-(ハイフン)で始まる文字列をオプション値として受け取る方法が知りたいです。

use Getopt::Long qw(:config posix_default no_ignore_case gnu_compat);

my $options = {};
my $result = GetOptions($options, "opt:s", "opt2:i");

みたいなコマンドで、

$ ./command --opt -0100

とかやっても、

Unknown option: 0100

とか言われる。orz

$ ./command --opt "-0100" 

でも一緒。

一応、

$ ./command --opt=-0100

で解決するけど、このオプションだけイコール必須、とか気持ち悪い...

0
0
1

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?