I have an array with elements like this:
@ORF= (MEZQFVECQWSXC*FVCXRCT*, MAEZCRTDRX*AZEFZC*AZERC*)
I want to split every array so that each elment starts with 'M' and ends with '*', no extra '*' in between.
so my example above should give me
@ORF = (MEZQFVECQWSXC*,MAEZCRTDRX*)
I thought about first splitting each elements like this:
foreach (@ORF) {
my $true= split /\*/, $_;
push @ORF, $true
}
and then splicing the others out with and if statement, but this does not work.
I also considered using grep
@ORF= grep m/M.*\*/, @ORF;
But this does not affect the array.
I am getting increasingly confused and google is not helping... Please help me out?