in reply to Ways of Passing Configuration Parameters
#!/usr/bin/perl -w use strict; use Getopt::Long; use Data::Dumper; my @options = (-something => 'abc', -xyz => -abc => 'def', 'leftover') +; my @leftovers; my %opts; my @save_ARGV = @ARGV; { local @ARGV = @options; my $result = GetOptions(\%opts, 'something=s','xyz','abc=s'); @leftovers = @ARGV; } print Dumper(\%opts); print Dumper(\@leftovers); print Dumper(\@ARGV);
|
|---|