uninitialized value in addition on line 1153
$counts_rebin[$k] = ($counts_rebin[$k] + $value); # l:1153

Try writing that line this way, and that warning will go away (in this case, the warning is just a matter of style -- no impact on the final results):

$counts_rebin[$k] += $value; # l:1153

unin. val in multiplication (line 1158)

my $totcount = $rawchannel[$j]; my $split1 = (($energy_before[$j]-$energy_rebin[$k])*$totcount) +/($energy_before[$j]-$energy_before[${j}-1]); # l:1158
That bit is in a for loop that goes up to "$j==16831" -- are you sure you have that many elements in @rawchannel?

unin. val in subtraction (line 1162),

$counts_rebin[$k]=($counts_rebin[$k]+($totcount-$split1)); # l +:1162
Probably the same issue as the previous one, relating to $totcount (and @rawchannel), but I can't say for sure.

unin. val. in numeric ge (>=) in line 1148

if(($energy_rebin[$k] >= $energy_before[$j])){ # l:1148

I think there may be something odd going on with how you are incrementing $k inside the main for loop ($j=0..16381) -- maybe it's getting incremented to far? But that's just a guess. Maybe the "until" loop at line #1168 should be done like this:

until ($k==@energy_rebin or $energy_rebin[$k]>=$energy_bef +ore[$j]){ $k += 1; }
That would make sure that $k never points to an uninitialized offset in that array (but I don't know if it does the right thing as far as your algorithm is concerned).

Modification of a read-only value attempted at line 1188

printf REBINOUT pack('V',$counts_rebin[$i]); # l: 1188
I really don't understand why you are using "printf" there -- it makes no sense to me. Wouldn't you rather take the value returned by "pack" and just "print" it?

(update: the first item -- line #1153 -- is one of many examples where your coding style is more fortran-like rather than perlish (or even C-like), which I suppose is not unexpected for this sort of app... And the last item (printf) might be a symptom of C-centric style. Of course, you don't need to make it "more perlish" just for the sake of doing that, but increasing the use of some of the more compact perl idioms might be a good thing.)


In reply to Re: Spurious `undefined' values and conversion issues by graff
in thread Spurious `undefined' values and conversion issues by sf_ashley

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • 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:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.