On Jun 25, 2:01 pm, [EMAIL PROTECTED] (Rob Dixon) wrote:
> Eng. Fadhl Al_Akwaa wrote:
>
> > Hi All
> > I could not do it with matlab could perl do it?
> > I appreciate if I have solution for this problem
> > I  try to extract two columns from a text file(8 columns) with variable
> > number of headerlines, and variable line length.
> > below is one line of my data
>
> > S= ¡GO:0000022  0.00312066574202497 9/2884  1/597   0.0023457  NA  mitotic
>
> > spindle elongation  YBL084C ¡
>
> > How  could I get column 4 , 5 using perl.
>
> Does this short Perl program help you?
>
> Rob
>
> use strict;
> use warnings;
>
> use strict;
> use warnings;
>
> my $s = 'GO:0000022  0.00312066574202497 9/2884  1/597   0.0023457  NA  
> mitotic
> spindle elongation  YBL084C';
>
> my ($col4, $col5) = (split ' ', $s)[3, 4];
>
> print "$_\n" foreach $col4, $col5;
>
> **OUTPUT**
>
> 1/597
> 0.0023457

perl could do it with one line.
as I know I am new perl user how I could pass to it the string s and
the number of column return{3 or 4}


--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to