I have the following Perl script:
sub {
my $sequence=\"SEQUENCE1\";
my $sequence2=\"SEQUENCE2\";
my @Array = ($sequence, $sequence2);
return \\@
You can do this, but you need to change vectTEST.pl -- currently you have an anonymous sub that you're not assigning to anything. Change the perl script to:
$vect = sub {
my $sequence="SEQUENCE1";
my $sequence2="SEQUENCE2";
my @Array=();
push(@Array,$sequence,$sequence2);
return \@Array;
};
1;
Then, you can do this in bash:
mapfile -t seq < <(perl -E 'do "vectTEST.pl"; say join "\n", @{$vect->()}')
for idx in "${!seq[@]}"; do echo "$idx ${seq[idx]}"; done
0 SEQUENCE1
1 SEQUENCE2