use Getopt::Std; my %opt; getopt('abc',\%opt); Multivalued(\%opt); #... sub Multivalued { # convert lists to array refs. my $href = shift; while( my ($k, $v ) = each %$href ) { my @anon = split /\,/, $v or next; $href -> { $k } = \@anon; } }