Skip to content

Instantly share code, notes, and snippets.

@kyanny
Created May 23, 2013 09:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kyanny/5634832 to your computer and use it in GitHub Desktop.
Save kyanny/5634832 to your computer and use it in GitHub Desktop.
#!/usr/bin/env perl
use strict;
use warnings;
use Getopt::Long;
my @c = ();
my @m = ();
GetOptions('c=s' => \@c, 'm=s' => \@m);
my $argument = shift @ARGV;
die "a mandatory parameter `argument'" unless $argument;
use Data::Dumper; print Dumper {'c' => \@c, 'm' => \@m, 'argument' => $argument};
@kyanny
Copy link
Author

kyanny commented May 23, 2013

$ perl opt.pl -c name1 -c name2 -m name3 argument
$VAR1 = {
          'argument' => 'argument',
          'c' => [
                   'name1',
                   'name2'
                 ],
          'm' => [
                   'name3'
                 ]
        };

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment