I'm not really up to speed with this, but I think you might want something like:
use Math::GSL::Histogram qw/:all/;
use Math::GSL qw/:all/;
$file = "blah.txt";
$mode = 'w';
$h = gsl_histogram_alloc(3);
gsl_histogram_set_ranges($h, [0, 41, 61, 100], 4);
gsl_histogram_increment ($h, 0);
gsl_histogram_increment ($h, 41);
gsl_histogram_increment ($h, 61);
gsl_histogram_increment ($h, 100);
$stream = gsl_fopen $file, $mode;
gsl_histogram_fprintf($stream, $h, '%f', '%f');
At least that runs without error. On my Windows Vista box, I need to view 'blah.txt' in something like wordpad. For me, notepad ignores the newlines.
It might be worth your while to download the Math::GSL source from CPAN, as the test files (in the 't' folder) provide useful examples of correct usage.
Cheers,
Rob
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.