Amit Saxena wrote:
On Wed, Jun 25, 2008 at 1:20 PM, fadlyemen <[EMAIL PROTECTED]> wrote:
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.
$str= 'GO:0000022 0.00312066574202497 9/2884 1/597 0.0023457 NAmitotic
spindle elongation YBL084C '
(undef, undef, undef, $var1, $var2) = split (/\s*/, $str);
Perl arrays and lists start at zero so that stores columns 3 and 4 *not*
4 and 5 as the OP wants. Using a split pattern that matches zero times
is the same as using an empty pattern, it will split on individual
non-whitespace characters, not columns.
John
--
Perl isn't a toolbox, but a small machine shop where you
can special-order certain sorts of tools at low cost and
in short order. -- Larry Wall
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/