From what you've said, your function takes a callback and two list, modifies the elements of both lists and returns a third list. Your function is insane.
( No, I misunderstood. It only modifies the first array which makes the rest of this post moot. The function is still pretty crazy, though )
Anyway, you seem to be asking how to create an array of aliases. It's actually possible with little work!
sub foo(\@) {
my ($array) = @_;
$_ = uc($_) for @$array;
}
my @array = qw( foo bar Foo Bar );
foo @{ sub { \@_ }->( grep /^[A-Z]/, @array ) };
print "$_\n" for @array;
foo
bar
FOO
BAR
Of course, an array wouldn't normally be used at all.
sub foo {
$_ = uc($_) for @_;
}
my @array = qw( foo bar Foo Bar );
foo grep /^[A-Z]/, @array;
print "$_\n" for @array;
foo
bar
FOO
BAR
|