mmartin has asked for the wisdom of the Perl Monks concerning the following question:
####START CODE my $location; my $user_cfg; #Define argument types GetOptions('location=s' => \$location, 'cfg=s' => \$user_cfg); # Process Command Line Arguments if ( @ARGV > 0 ) { #Check if cfg option was specified if ($user_cfg) { #Replace any spaces found in a "quoted" filename #i.e. ("sample test" --> "sample-test") if ($user_cfg =~ /\s/) { $user_cfg =~ s/\s+/-/g; } if (@ARGV) { foreach my $opt (@ARGV) { $user_cfg .= "-$opt"; } } } } print "location = $location\n"; print "cfg File = $user_cfg\n"; ### END CODE
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Parsing Command Line Options
by toolic (Bishop) on Jan 12, 2012 at 20:45 UTC | |
by mmartin (Monk) on Jan 12, 2012 at 20:57 UTC | |
by mmartin (Monk) on Jan 12, 2012 at 20:51 UTC | |
by Tanktalus (Canon) on Jan 12, 2012 at 21:05 UTC | |
by mmartin (Monk) on Jan 12, 2012 at 21:16 UTC | |
|
Re: Parsing Command Line Options
by mmartin (Monk) on Jan 12, 2012 at 21:18 UTC | |
|
Re: Parsing Command Line Options
by mmartin (Monk) on Jan 12, 2012 at 21:20 UTC | |
by TJPride (Pilgrim) on Jan 12, 2012 at 21:51 UTC |