in reply to Vicious circle.
or else this:### First I read from database. $data_path = "data/mixed.data"; open(DAT, $data_path) || die("Could not open file!"); @rawdata=<DAT>; close(DAT); chomp @rawdata; ## <<-- add this line here
Either one alone will fix the problem. (Don't do both.)### Then I overwrite mixed.data with $data_path = "data/mixed.data"; open(O, ">$data_path"); print O @scale; ## <<-- don't use 'join "\n",...' close(O);
update: I should point out that the first solution will work equally well with your initial test case (setting $now,$nill,$null to internal time values, instead of reading them from a file) -- chomp only removes the input record separator (value of $/) from the end of whatever string(s) you pass to it; when a string does not end with with that value, chomp does not alter it. Meanwhile, just doing "print O @scale" will do the wrong thing if the array elements don't end with newlines.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Vicious circle.
by nasa (Beadle) on Feb 08, 2006 at 05:34 UTC |