Skip to content

Instantly share code, notes, and snippets.

@alexm
Created February 3, 2012 20:45
Show Gist options
  • Save alexm/1732411 to your computer and use it in GitHub Desktop.
Save alexm/1732411 to your computer and use it in GitHub Desktop.
Getopt::Long subs
#!/usr/bin/env perl
use strict;
use warnings;
use 5.010;
use Getopt::Long;
my %opt = ( 'list' => sub { say $_[0] } );
GetOptions( 'list=s' => sub { $opt{ $_[0] }->( $_[1] ) } );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment