Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
The code is supposed to pick out the elements in the second array that contain the information in the first. I'm am unsure whether the problem is the code or data. I have messed around with the pattern match and have tried removing the whitespace from the data, with no luck. I am probably missing something really obvious so any help would be appreciated. Thanks@random_header = ('>143B_HUMAN (P31946) 14-3-3 protein beta/alpha (Pro +tein kinase C inhibitor protein-1) (KCIP-1) (Protein 1054', '>AAAT_HU +MAN (Q15758) Neutral amino acid transporter B(0) (ATB(0)) (Sodium-dep +endent neutral amino acid transporter type 2) (RD114/simian type D re +trovirus receptor) (Baboon M7 virus receptor)'); @all_records = ('>143B_HUMAN (P31946) 14-3-3 protein beta/alpha (Prote +in kinase C inhibitor protein-1) (KCIP-1) (Protein 1054) TMDKSELVQKAKLAEQAERYDDMAAAMKAVTEQGHELSNEERNLLSVAYKNVVGARRSSW RVISSIEQKTERNEKKQQMGKEYREKIEAELQDICNDVLELLDKYLIPNATQPESKVFYL KMKGDYFRYLSEVASGDNKQTTVSNSQQAYQEAFEISKKEMQPTHPIRLGLALNFSVFYY EILNSPEKACSLAKTAFDEAIAELDTLNEESYKDSTLIMQLLRDNLTLWTSENQGDEGDA GEGEN', '>AAAT_HUMAN (Q15758) Neutral amino acid transporter B(0) (ATB +(0)) (Sodium-dependent neutral amino acid transporter type 2) (RD114/ +simian type D retrovirus receptor) (Baboon M7 virus receptor) MVADPPRDSKGLAAAEPTANGGLALASIEDQGAAAGGYCGSRDQVRRCLRANLLVLLTVV AVVAGVALGLGVSGAGGALALGPERLSAFVFPGELLLRLLRMIILPLVVCSLIGGAASLD PGALGRLGAWALLFFLVTTLLASALGVGLALALQPGAASAAINASVGAAGSAENAPSKEV LDSFLDLARNIFPSNLVSAAFRSYSTTYEERNITGTRVKVPVGQEVEGMNILGLVVFAIV FGVALRKLGPEGELLIRFFNSFNEATMVLVSWIMWYAPVGIMFLVAGKIVEMEDVGLLFA RLGKYILCCLLGHAIHGLLVLPLIYFLFTRKNPYRFLWGIVTPLATAFGTSSSSATLPLM MKCVEENNGVAKHISRFILPIGATVNMDGAALFQCVAAVFIAQLSQQSLDFVKIITILVT ATASSVGAAGIPAGGVLTLAIILEAVNLPVDHISLILAVDWLVDRSCTVLNVEGDALGAG LLQNYVDRTESRSTEPELIQVKSELPLDPLPVPTEEGNPLLKHYRGPAGDATVASEKESV M', '>143E_HUMAN (P42655) 14-3-3 protein epsilon (Mitochondrial import + stimulation factor L subunit) (Protein kinase C inhibitor protein-1) + (KCIP-1) (14-3-3E) MDDREDLVYQAKLAEQAERYDEMVESMKKVAGMDVELTVEERNLLSVAYKNVIGARRASW RIISSIEQKEENKGGEDKLKMIREYRQMVETELKLICCDILDVLDKHLIPAANTGESKVF YYKMKGDYHRYLAEFATGNDRKEAAENSLVAYKAASDIAMTELPPTHPIRLGLALNFSVF YYEILNSPDRACRLAKAAFDDAIAELDTLSEESYKDSTLIMQLLRDNLTLWTSDMQGDGE EQNKEALQDVEDENQ'); foreach $header (@random_header) { foreach $element (@all_records) { if ($element =~ /$header/) { push (@random_record, $element); } } }
20021119 Edit by Corion: Changed title to be more descriptive
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: ehh!
by nothingmuch (Priest) on Nov 18, 2002 at 20:12 UTC | |
|
Re: Searching one array with elements from another (was: ehh!)
by jdporter (Paladin) on Nov 18, 2002 at 21:37 UTC |