in reply to Vicious circle.

To clarify japhy's instructions, you want to make just one of the following changes -- either 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
or else this:
### 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);
Either one alone will fix the problem. (Don't do both.)

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
    Been fighting with that one for two days now.
    Works like a charm now.
    May God Bless you.
    Nasa.