in reply to Spurious `undefined' values and conversion issues
$j=0; for ($j=0;$j<=16381;$j++){ if (defined($counts_rebin[$j])){ next; } else{ $counts_rebin[$j]=0; } }
into this:
for my $j (0..16381) { $counts_rebin[$j] = 0 unless defined $counts_rebin[$j]; }
You could even take things a step further and employ map to initialize the @energy_rebin array by changing this:
for ($i=0; $i<16834; $i++){ $energy_rebin[$i] = ($rebin_width * $i); }
into this:
my @energy_rebin = map { $_ * $rebin_width } (0..16833);
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Spurious `undefined' values and conversion issues
by sf_ashley (Sexton) on May 30, 2008 at 18:54 UTC |