very strange behaviour

F

fedeabascal

Dear all,

I'm finding a very strange behaviour of perl when trying to print
something. Look at this code:

print " Number of informative (entropy < ",$fields{'ENTROPY'}," and
gaps < ",$fields{'GAPS'},") columns : $ok_columns\n",
print " Number of columns considered poorly informative
: ", scalar(keys(%discarded_columns)), "\n";

The result is that the second "print" prints before the first "print".
Always. Look at the output:


Number of columns considered poorly informative : 33
Number of informative (entropy < 4.2 and gaps < 0.2) columns : 214
1


Additionally, after both "prints" are printed a newline with just a "1"
is printed.

Both things happen with different operative systems. If I replace both
lines with:

print "hello\n";
print "bye\n";

then, everything works as expected. The output is:

hello
bye


I can't imagine why this happens!!

Best,
Federico
 
B

Bengt-Arne Fjellner

Dear all,

I'm finding a very strange behaviour of perl when trying to print
something. Look at this code:

print " Number of informative (entropy < ",$fields{'ENTROPY'}," and
gaps < ",$fields{'GAPS'},") columns : $ok_columns\n",
print " Number of columns considered poorly informative
: ", scalar(keys(%discarded_columns)), "\n";

The result is that the second "print" prints before the first "print".
Always. Look at the output:


Number of columns considered poorly informative : 33
Number of informative (entropy < 4.2 and gaps < 0.2) columns : 214
1


Additionally, after both "prints" are printed a newline with just a "1"
is printed.
Youre printing the result of print which is 1
either do
print " Number of informative (entropy < ",$fields{'ENTROPY'}," and
gaps < ",$fields{'GAPS'},") columns : $ok_columns\n" ; # <--- OBS this
semicolon
print " Number of columns considered poorly informative
: ", scalar(keys(%discarded_columns)), "\n";

or in one print
print " Number of informative (entropy < ",$fields{'ENTROPY'}," and
gaps < ",$fields{'GAPS'},") columns : $ok_columns\n",
" Number of columns considered poorly informative : ",
scalar(keys(%discarded_columns)), "\n";
 

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

Forum statistics

Threads
473,755
Messages
2,569,535
Members
45,007
Latest member
obedient dusk

Latest Threads

Top