if (@_ == 2) { my ($type, $ref) = @_; $type =~ s/_/-/g; return sort { short_sorts($a, $b, $type) } @$ref; } #### my @list = qw(red orange yellow green blue purple); my @sorted = short_sorts ci_a => \@list; print "@sorted\n"; # says "blue green orange purple red yellow" #### croak "$type is not supported" if $type && !exists $sorts{$type};