use Getopt::Long; Getopt::Long::Configure('prefix_pattern=(?:--|-)?'); $rv = GetOptions( 'help|h!' => \$help, 'b!' => \$backup, 'u!' => \$upd_sybase, 's!' => \$silent, 'update' => \$update, 'server=s' => \$server, 'user=s' => \$user, 'password=s' => \$password, ); push(@args, $help ? "--help" : "--nohelp") if defined $help; push(@args, $backup ? "--b" : "--nob" ) if defined $backup; push(@args, $upd_sybase ? "--u" : "--nou" ) if defined $upd_sybase; push(@args, $silent ? "--s" : "--nos" ) if defined $silent; push(@args, "update" ) if defined $update; push(@args, "server=$server" ) if defined $server; push(@args, "user=$user" ) if defined $user; push(@args, "password=$password" ) if defined $password; print(join(' ', @args), $/);
In reply to Re: Mixing command line arguments
by ikegami
in thread Mixing command line arguments
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |