in reply to Construct Key by split

Something like:

use strict; use warnings; my @arrofIndices = (1, 3); my $str = 'Zeroth|First|Second|Third'; my $prodKey = join "|", (split /\|/, $str)[@arrofIndices]; print $prodKey

Prints:

First|Third

Perl reduces RSI - it saves typing