On Tue, Jun 09, 2009 at 12:37:10AM +0400, Richard Hainsworth wrote:
> I write a hash to a file delimited by tabs, eg
> my $fn=open('data.csv',:w);
> my %x=<one two three four> Z 1,2,2.1,3;
> $fn.say('record-name'~map("\t$^a\t$^b"),%x);
> $fn.close;
> The output sometimes contains either the keys or the values padded with  
> single spaces on either side (I cannot find a pattern for the spaces). I  
> am not sure whether this a bug of say (or $fn.say() ).

Well, regardless of whether there are extra spaces, please note that
the default stringifications are not intended as a serialization
format.  They are intended only to provide a bit of human readability
for the common case of small, spaceless items such as numbers and
words; they make no guarantee about the sanity of the delimiters.

> So now I want to read in the data again. (The problem arises because  
> perl6 has a memory leak and my program segfaults after five loops, so I  
> need to store the intermediate data; this is a serialisation problem,  
> but I dont need to go to the extreme of yaml for it).

Hmm, if you think yaml is extreme, yowie, the world is a harsh place...

I guess I can only suggest that you use .perl instead, for a minimal
serialization format.  Or write your own explicit formatting and
serialization using .fmt calls.


Reply via email to