in reply to Re^2: Odd number of elements in anonymous hash!
in thread Odd number of elements in anonymous hash!
If you want a SCALAR, take out the outermost {}, and use an assignment instead of my recommended =>.
You may want to remove the "push" statement from the code entirely, because with it, you are entering the same information twice, into @data.
I hope life isn't a big joke, because I don't get it.
-SNL
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^4: Odd number of elements in anonymous hash!
by Anonymous Monk on Aug 19, 2012 at 19:44 UTC | |
Thanks! | [reply] [d/l] |
by Athanasius (Archbishop) on Aug 20, 2012 at 09:08 UTC | |
Hello Anonymous Monk, I don’t see how the code you gave in your original question can be what you are really using, since you have:
which first opens the file for writing — thereby truncating it! — and only then reads in its (now empty) contents. In any case, it is simpler (and therefore less error-prone) to read and write the file in wholly separate steps. Here is a script which does that:
This outputs:
as required. Hope that helps, Athanasius <°(((>< contra mundum | [reply] [d/l] [select] |