in reply to Difficulty saving PDL's to disk with Data::dumper

Perhaps you should post the code used to create this structure? Most likely you are not creating the data structure you think you are, but without the code used to create the PDL's and the data structure there is no way to know.

Also it might help to come up with a small code sample that shows the problem by (a) creating a small portion of the structure with just one PDL and (b) showing how you call Data::Dumper to output the structure. The output would be less overwhelming and help us and you focus on the problem. The process of creating the code sample might even solve it for you without waiting for our help!

A further thought: since there may be a lot of code and data involved here, perhaps you might want to enclose your code and output in <readmore>....</readmore> tags? Those interested in helping you will read more and you will be less likely to lose people who could help but can't see the forest for the trees. Some people will just skim past something where the detail and main idea aren't clearly separated out from each other.

Best, beth

Update: After looking at the PDL source code (I assume you mean this PDL?), it also appears that the "PDL" class is merely a wrapper around a C pointer, in which case Data::Dumper is merely printing out a pointer address that will have no meaning on reload - hence your segmentation fault when you try to reload it.

Replies are listed 'Best First'.
Re^2: Difficulty saving PDL's to disk with Data::dumper
by Chah (Initiate) on Mar 01, 2009 at 13:39 UTC
    Hi Elisheva, Thanks for your replies. The code that created the file is relatively simple:
    use Data::Dumper; $Data::Dumper::Purity = 1; print "Saving media $media->{name}\n"; open(FILE,">$media->{name}"); print FILE Dumper($media); close FILE;
    If you meant the code that was used to create the %media hash itself, that's more unwieldy to analyze. It's a large structure with things dropped in it from different subfunctions, it's not so easy to isolate out just a small part. I think the second reply has nailed it though. I need to use PDL::IO::Dumper (well, I need to read it first) Thanks again for the suggestions. Will go and give that a try.