gasho has asked for the wisdom of the Perl Monks concerning the following question:
Dear Monks, I have two arrays different sizes but potentialy same elements. I would like to extract from Bigger array only elements common, please see my code and pseudo code bellow, Thanks
@Names=qw(A B C); @FullRecord=qw(A_1 D_4 C_3 F_6 B_2); foreach $el (@FullRecord) { @SplitArray=split(/\_/,$el); #Pseudo code #if @SplitArray[0] found in @Names then push $el into @DesiredRecord #Result is DesiredRecod =qw(A_1 C_3 B_2);
(: Life is short enjoy it :)
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: How to juggle between two arrays that are not same size
by kyle (Abbot) on Dec 19, 2007 at 17:19 UTC | |
Re: How to juggle between two arrays that are not same size
by jrsimmon (Hermit) on Dec 19, 2007 at 17:24 UTC | |
Re: How to juggle between two arrays that are not same size
by mwah (Hermit) on Dec 19, 2007 at 18:23 UTC | |
Re: How to juggle between two arrays that are not same size
by perlfan (Vicar) on Dec 19, 2007 at 20:33 UTC | |
Re: How to juggle between two arrays that are not same size
by Anonymous Monk on Dec 19, 2007 at 17:25 UTC |
Back to
Seekers of Perl Wisdom