> Hi, I have a question regarding the following script.
> [code]
Did you write the code?
> This should be the output.
> [data1]
> However, the output is the following:
> [data2]
Did you know that [data2] is near enough just [data1], twice?
Which is probably because the somethings in this code:
for ($i=0; $i<$n; $i++){
# print something1
}
for ($i=0; $i<$n; $i++){
# print something2
}
come out (almost) the same.
the somethings are:
printf "%-15s %s\n", $ID[$i], join("", @{$ALIGNMENT{$ID[$i]}});
and
print "$ID[$i]\n";
So my guess is the printf reduces to:
print "$ID[$i] \n";
(ie with just an extra space at the end of the lines)
This would happen if the "%-15s" bit grabs the $ID[$i]
and the " %s\n" bit grabs the joined stuff, and the
@{...} stuff evaluates to nothing. I would guess that
that is exactly what is happening.
hth.