my $opt = { # this has to be first because the sub-refs # below are closures using it. grot => [], }; my $splitter = sub { my ($name, $val) = @_; push @{$opt->{$name}}, split q{,}, $val; }; GetOptions( $opt, 'grot=s@' => $splitter, ) or die "can't parse options";