question about output

Discussion in 'Perl Misc' started by opmn, Nov 2, 2006.

  1. opmn

    opmn Guest

    The output of my program is messed up.

    This is the code for output:
    -------------------------------
    printf("%5d Q0 %15s %5d %.10f Exp\n", $query_id,
    $docidmap{$docid}, $rank, $scores{$docid});
    ------------------------------

    The output is expected to have 6 columns. But actually, I got only last
    3. I did debugging and here is what I get:
    ------------------------------
    DB<13> printf("%5d", $query_id);
    152
    DB<14> printf("%5d Q0", $query_id);
    152 Q0
    DB<15> printf("%5d Q0 %15s", $query_id, $docidmap{$docid});
    152 Q0 DOE1-62-0080
    DB<16> printf("%5d Q0 %15s %5d", $query_id, $docidmap{$docid},
    $rank);
    1Q0 DOE1-62-0080
    -------------------------------

    Here the value of $rank is 1. It's so weird that when $rank is added to
    the output, it begins from the beginning of the line. Anyone tell me
    why is this happening and how can I avoid it?

    Thanks for any tip!
    opmn, Nov 2, 2006
    #1
    1. Advertising

  2. opmn

    opmn Guest

    Problem solved... some stupid bug... never mind...
    opmn, Nov 2, 2006
    #2
    1. Advertising

  3. opmn

    Joe Smith Guest

    opmn wrote:
    > Problem solved... some stupid bug... never mind...


    The failure to use chomp() or the equivalent is a programmer
    error, not "some stupid bug".
    Joe Smith, Nov 2, 2006
    #3
    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. John Bentley

    Output / Debug window output bug?

    John Bentley, Sep 10, 2003, in forum: ASP .Net
    Replies:
    0
    Views:
    591
    John Bentley
    Sep 10, 2003
  2. chuck amadi
    Replies:
    1
    Views:
    489
    Larry Bates
    Jun 23, 2004
  3. Paul
    Replies:
    1
    Views:
    430
  4. jmr
    Replies:
    2
    Views:
    334
  5. pratap
    Replies:
    3
    Views:
    456
    James Kanze
    Jul 19, 2007
Loading...

Share This Page