- my $a = shift;
- my $r = _check_ref $a, $p;
- my %deref = (
- SCALAR => sub { push @args, $$a },
- ARRAY => sub { push @args, @$a },
- HASH => sub { push @args, %$a },
- GLOB => sub { push @args, *$a },
- CODE => sub { push @args, &$a }
- );
- $deref{$r}->();
- } elsif ($p =~ /[\@\%]/) {
+ my $arg = shift;
+ my $reftype = _check_ref $arg, $sigil;
+
+ push @args, $reftype eq 'SCALAR'
+ ? $$arg
+ : ($reftype eq 'ARRAY'
+ ? @$arg
+ : ($reftype eq 'HASH'
+ ? %$arg
+ : ($reftype eq 'GLOB'
+ ? *$arg
+ : &$arg # _check_ref ensures this must be a code ref
+ )
+ )
+ );
+
+ } elsif ($sigil =~ /[\@\%]/) {