I want to filter elements of @array
which begin with elements of @search
:
my @array = \
my @array = "aaaaa" .. "fffff";
my @search = "aaaa" .. "cccc";
my $join = @search.join('|');
my $rx = rx{ ^ <{$join}> };
@array.grep( * ~~ $rx ).map( *.put )
You need to create the join string separately of it will evaluate the array join for each match. But the basically gives you what you want without using EVAL.