question about output

O

opmn

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!
 
J

Joe Smith

opmn said:
Problem solved... some stupid bug... never mind...

The failure to use chomp() or the equivalent is a programmer
error, not "some stupid bug".
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,764
Messages
2,569,565
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top