Never mind.  It is working now.

Thanks,

Aiguo

-----Original Message-----
From: Li, Aiguo (NIH/NCI) 
Sent: Thursday, December 02, 2004 10:11 AM
To: Perl Beginners
Subject: Where is it wrong with my code


Hello, all.

I am trying to assign a "P" for any values greater than 1.0 and assign a "A"
otherwise.  However, I need to skip the header line and the first column.
Something is wrong with my code and it does not skip the first column well.
Please help me to detect the bug.

Thanks,

Aiguo

#!/usr/bin/perl
use warnings;
use strict;

while (<DATA>) {
        next unless /_at/;
        my @groupPA = split(/\t/, $_);
        print " \t @groupPA \n";
foreach my $groupPA (@groupPA){
        my $call;
        my @PAcall;
        next unless $groupPA =~ (/\d+/);
        print $groupPA;
        #print $_;
        if($groupPA =~ /\d+/ && $groupPA >= 1 ){$call = "P";}
        elsif($groupPA =~ /\d+/ && $groupPA < 1){$call ="A";}
        push (@PAcall, $call);
        #print "@PAcall \n";
        }
        }
        __DATA__
        Type    HF      LY      M       MSS     NC      NR      N       D
CC      CR      MS      T98     U87
        1405_i_at       1.2     0       0       0       0       0       0
1       0       0       0       0       0
        1431_at 1.2     0       1       2       0       0.5     1.5     2
2       1.333333333     2       0       1.333333333
        1438_at 0.4     0.666666667     2       0       2       2       0
2       2       2       2       0       0
        1487_at 2       2       2       2       2       2       2       2
2       2       2       2       2
        1494_f_at       0.4     0       0       1       0       0       0
1       1       0       0       0.666666667     0.666666667
        1598_g_at       2       2       2       2       2       2       2
2       2       2       2       2       2
        160020_at       2       2       2       2       0       1       2
2       2       2       2       2       2
        1729_at 2       2       2       2       0       0       0       2
2       2       2       2       2
        1773_at 1.2     2       2       0       0       0       0       2
1       1.333333333     2       0       2
        177_at  1.2     1.333333333     2       2       2       1       1
2       2       1.333333333     2       2       2
        179_at  2       2       2       2       2       1       1.5     2
2       2       1       2       1.333333333
        [snip] 

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


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


Reply via email to