Hash of array printing issue.

Discussion in 'Perl' started by tanghz, Jul 20, 2009.

  1. tanghz

    tanghz

    Joined:
    Jul 20, 2009
    Messages:
    1
    This is the data:
    CHR08FS019528015 . . 19528015 19528064 5.00E-20 . . 8
    CHR08FS019528015 . . 19528091 19528140 5.00E-20 . . 8
    CHR08FS019528217 . . 19528217 19528266 5.00E-20 . . 8
    CHR08FS019528217 . . 19528273 19528322 5.00E-20 . . 8

    I want to use hash of array to merge the first two lines and the last two lines with the scripts below:



    while (<>){
    chomp;
    @t=split /\t/;
    push (@{ $Objs{$t[0]} }, $t[1], $t[2], $t[3], $t[4], $t[5], $t[6], $t[7], $t[8]) ;
    }

    for $Obj (keys %Objs ){
    print "$Obj\t";
    print join("\t", @{ $Objs{$Obj}});
    print "\n";



    It should be like this
    CHR08FS019528015 . . 19528015 19528064 5.00E-20 . . 8 . . 19528091 19528140 5.00E-20 . . 8
    CHR08FS019528217 . . 19528217 19528266 5.00E-20 . . 8 . . 19528273 19528322 5.00E-20 . . 8


    but the real output is this:

    CHR08FS0.9528217. 19528273. 19528322 5.00E-20 ..00E-20. 8 . 8
    CHR08FS0.9528015. 19528091. 19528140 5.00E-20 ..00E-20. 8 . 8


    I checked all the hash array element has the correct data, just the output is incorrect, it seems the second part of the data overlapped with the first part, how come??? Who can help???

    thanks
    tanghz, Jul 20, 2009
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. rp
    Replies:
    1
    Views:
    478
    red floyd
    Nov 10, 2011
  2. Anthony Martinez
    Replies:
    4
    Views:
    254
    Robert Klemme
    Jun 11, 2007
  3. Michal Suchanek
    Replies:
    6
    Views:
    212
    Nobuyoshi Nakada
    Jun 13, 2007
  4. Srijayanth Sridhar
    Replies:
    19
    Views:
    580
    David A. Black
    Jul 2, 2008
  5. Mothra
    Replies:
    16
    Views:
    181
    John W. Krahn
    Sep 12, 2003
Loading...

Share This Page