$j=0; for ($j=0;$j<=16381;$j++){ if (defined($counts_rebin[$j])){ next; } else{ $counts_rebin[$j]=0; } } #### for my $j (0..16381) { $counts_rebin[$j] = 0 unless defined $counts_rebin[$j]; } #### for ($i=0; $i<16834; $i++){ $energy_rebin[$i] = ($rebin_width * $i); } #### my @energy_rebin = map { $_ * $rebin_width } (0..16833);