http://www.perlmonks.org?node_id=764662

hda has asked for the wisdom of the Perl Monks concerning the following question:

Oh wise monks!

I am trying to use Math::GSL::histogram to construct an histogram with logarithmic bins. What I want to do is to read the data from an array or a PDL piddle. However, Math::GSL seems to require a "stream", i.e. a file to read data from. I tried to save my data to a file in several formats but I could not manage to get Math::GSL to read it. I am obviously doing something wrong and I will appreciate any hint from you!

Here is my code, it terminates with segment fault:

my $fo = gsl_fopen('myfile', 'w'); # sets the output file my $fi = gsl_fopen( $input_stream ); # here is where I can't understan +d how it works my $h = gsl_histogram_alloc (5); gsl_histogram_fscanf($fi, $h); my $range = [ 1.0, 10.0, 100.0, 1000.0, 10000.0, 100000.0 ]; gsl_histogram_set_ranges($h, $range, 4); gsl_histogram_fprintf($fo, $h, "%g", "%g"); gsl_fclose($fi); gsl_fclose($fo);


Thanks in advance!