I want to be able to capture in a regex output say like this: Viridiplantae Crenarchaeota Fungi Crenarchaeota Fungi Fungi Fungi Metazoa Metazoa Euryarchaeota Fungi, using a regex:
The problem is I want to be able to capture the output not as a single scalar but as individual values to be used in an @array and stored in hash as individual keys say.
Much app help x.
Ok sorry I should have done;
my $key; while($line=<>){ if($line=~/\bkingdom\b\|(.*?)\|/g){ $key.=$1; } }
species|Caragana arborescens | genus|Caragana | subfamily|Papilionoide +ae | family|Fabaceae | order|Fabales | no rank|eurosids I | subclass| +Rosidae | no rank|core eudicots | no rank|eudicotyledons | no rank|Ma +gnoliophyta | no rank|Spermatophyta | no rank|Euphyllophyta | no rank +|Tracheophyta | phylum|Embryophyta | no rank|Charophyta/Embryophyta g +roup | no rank|Streptophyta | kingdom|Viridiplantae | superkingdom|Eu +karyota | no rank|cellular organisms | no rank|root || species|syncytium endosymbiont of Diaphorina citri | no rank|unclassif +ied beta proteobacteria (miscellaneous) | no rank|unclassified beta p +roteobacteria | class|beta subdivision | phylum|Proteobacteria | supe +rkingdom|Bacteria | no rank|cellular organisms | no rank|root || subspecies|Trypanosoma brucei brucei | species|Trypanosoma brucei | su +bgenus|Trypanozoon | genus|Trypanosoma | family|Trypanosomatidae | or +der|Kinetoplastida | no rank|Euglenozoa | superkingdom|Eukaryota | no + rank|cellular organisms | no rank|root || species|unculturable Mariana archaeon no. 1 | no rank|environmental sa +mples | no rank|unclassified Crenarchaeota | kingdom|Crenarchaeota | +superkingdom|Archaea | no rank|cellular organisms | no rank|root || species|Suillus aeruginascens | genus|Suillus | family|Boletaceae | or +der|Boletales | subclass|Hymenomycetidae | class|Hymenomycetes | phyl +um|Basid
@array= split(/\s+/, $key); print $array[0], $array[1], $arrray[2] etc..
Edit: g0n - code tags
In reply to capturing separately by ada
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |