in reply to Why is this split not doing anythine?
Update: Of course you can combine the grep that removes blank lines into the split line.use strict; use warnings; my $string="TOPO_DOM 1; /note=Cytoplasmic; /evidence=ECO:0000269|PubMe +d:24744376; TOPO_DOM 25..74; /note=Extracellular; /evidence=ECO:00002 +69|PubMed:24744376; TOPO_DOM 100..115; /note=Cytoplasmic; /evidence=E +CO:0000269|PubMed:24744376; TOPO_DOM 141..159; /note=Extracellular; / +evidence=ECO:0000269|PubMed:24744376; TOPO_DOM 183..227; /note=Cytopl +asmic; /evidence=ECO:0000269|PubMed:24744376"; my @split_topodom = split(/TOPO_DOM\s*/, $string); @split_topodom = grep {/\S/}@split_topodom; # remove blank lines print join "\n",@split_topodom; __END__ 1; /note=Cytoplasmic; /evidence=ECO:0000269|PubMed:24744376; 25..74; /note=Extracellular; /evidence=ECO:0000269|PubMed:24744376; 100..115; /note=Cytoplasmic; /evidence=ECO:0000269|PubMed:24744376; 141..159; /note=Extracellular; /evidence=ECO:0000269|PubMed:24744376; 183..227; /note=Cytoplasmic; /evidence=ECO:0000269|PubMed:24744376
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Why is this split not doing anythine?
by Anonymous Monk on Feb 22, 2023 at 21:52 UTC |