You could do (untested, and probably some experimentation needed to find a good cutoff point):and that lead me to realize that I could get what I want using eval: eval "&\$sub( " . join( ", ", map "\$_[$_][0]", 0..$#_ ) . " )"if( 0 == @_ ) { &$sub(); } elsif( 1 == @_ ) { &$sub( $_[0][0] ); } elsif( 2 == @_ ) { &$sub( $_[0][0], $_[1][0] ); } elsif( 3 == @_ ) { &$sub( $_[0][0], $_[1][0], $_[2][0] ); # etc to some arbitrary maximum number of arguments }
if ($#_ <= 255) { my $lim = $#_; &$sub(($_[0][0],$_[1][0],$_[2][0],$_[3][0],$_[4][0], $_[5][0],$_[6][0],$_[7][0],$_[8][0],$_[9][0], ... $_[255] )[0..$lim]); $#_ = $lim # remove autovivified arrayrefs } else { eval "&\$sub( " . join( ", ", map "\$_[$_][0]", 0..$#_ ) . " )"; }
In reply to Re: Getting a list of aliases to selected items from a list of array references
by ysth
in thread Getting a list of aliases to selected items from a list of array references
by tye
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |