agustina_s has asked for the wisdom of the Perl Monks concerning the following question:
Basically the $entry->DRs->elements() will return a reference to a list called DR.. in this case we reffered to the list whose first element=EMBL. Is there any way to make my output looks like the input... by modifying the map and grep function above? I tried to separate the map into two parts :print OUT join ";", map {${$_}[1],${$_}[2]} grep { ${$_}[0] eq "EMBL" +} $entry->DRs->elements(); INPUT : DR EMBL;ABC;DEF;-. DR EMBL;GHI;JKL;- DR PIR;MNO;PQR;- OUTPUT : EMBL ABC;DEF;GHI;JKL;
But the print out is still the same... Thanks in advanced...print OUT join ";", map {${$_}[1]}grep { ${$_}[0] eq "EMBL" } $entry-> +DRs->elements(),map {${$_}[2]} grep { ${$_}[0] eq "EMBL" } $entry->DR +s->elements(),"\n";
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: put only 2 elements in a line
by chromatic (Archbishop) on Jan 18, 2002 at 12:38 UTC | |
|
Re: put only 2 elements in a line
by jryan (Vicar) on Jan 18, 2002 at 13:00 UTC |