Click to See Complete Forum and Search --> : Problem: Writing into files on LINUX vs Windows


kimskams80
05-12-2009, 04:45 AM
Hi Gurus!!

A strange problem I am facing here .... I m writing an output in files..

$str= $phrase." ".$subj[$q]."\n";
push(@output, $str);


and then later on after end of loops, I write this array to a file
print OUT @output

When I executed this program on Windows, output was like


rotation 0
29 0
wait 0.375
cornballer 0
favor 0.5625
viewers 0
satisfying 0.5


and same program working on Linux gives this in putput

rotation 0
29 0
wait 0
cornballer 0.375
favor 0
viewers 0.5625
satisfying 0.5

Similarly, another excerpt from this output file:

on Linux

fresh 0
figured 0.5
6th 0
rocks 0
editing 0
em 0
final 0
surprise 0


same excerpt on Windows:


fresh 0.75
figured 0
6th 0
rocks 0
editing 0
em 0
final 0
surprise 0.25


I cannot understand whats the problem .. if someone can identify please.

Thanks

Sixtease
05-13-2009, 02:05 AM
I guess the problem will be somewhere else than in printing the arrays -- double check if the sources are identical and if the array always contains the same thing before being printed (obviously they don't). I think it will be somewhere in the program before the print statement.

So please 1) make sure you run the very same script on both platform and if so 2) paste the complete code here.