$flag = 1 if($arr[$i] =~ /job/); ... For example, the following arguments will fail: --file job15 --dir d1 --job some-job -fw "hello"
Why not use an exact string match instead of the regex /job/? i.e. if($arr[$i] eq '--job')
Update: See also my reply to your post GetOpt unknown args, I gave you some working code there.
In reply to Re: Parsing command-line arguments in a sophisticated way.
by haukex
in thread Parsing command-line arguments in a sophisticated way.
by ovedpo15
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |