in reply to Construct Key by split

my @elements = split /\|/,$$prodRef[$a]; my $prodKey = join ('|', @elements[@arrofIndices]);

Could be done in one line, but why?

Apparently, you're confusing code with text. You don't need to create a string with commas in it, you just want the list of indices as-is.