in reply to Use of Uninitialized Value- Multiple Errors

The first thing that you should do is add : use strict; use warnings to the code.
There are many errors past the runtime errors that you described. "use strict;" is important because it is a compile time "sanity check".

for (my $i=0; $i<=$chrsize{$chr}; $i++) { looks suspicious and may be an "off by one" error.
I couldn't figure out what this code is actually supposed to to in terms of an algorithm - just not enough context for me to do that.

use strict; use warnings; #initiate S for the whole genome #chrboundst = chr start index #chrbound = chr end index my $k=0; my @S=undef; #open OUT, "> temp.0"; my %chrboundst; my %index; # correct? my @fix; my @score; my %chrbound; foreach my $chr (keys %chrsize) { $chrboundst{$chr}=$k; for (my $i=0; $i<=$chrsize{$chr}; $i++) { $index{$k}="$chr\t$i"; $fix[$k]=1 if ($breakpoint{$chr}{$i}==1); # line 132 $score[$k]=$piRNA{$chr}{$i}-$penalty; $S[$k]=$S[$k-1]+$score[$k] if ($i>0); $S[$k]=$score[$k] if ($i==0); $S[$k]=0 if ($S[$k]<0 || $fix[$k]==1); # line 136 $k++; } $chrbound{$chr}=$k-1; # mark the chr end for recalculation } __END__ Global symbol "%chrsize" requires explicit package name (did you forge +t to declare "my %chrsize"?) at line 16. Global symbol "%chrsize" requires explicit package name (did you forge +t to declare "my %chrsize"?) at line 18. Global symbol "%breakpoint" requires explicit package name (did you fo +rget to declare "my %breakpoint"?) at line 20. Global symbol "%piRNA" requires explicit package name (did you forget +to declare "my %piRNA"?) at line 21. Global symbol "$penalty" requires explicit package name (did you forge +t to declare "my $penalty"?) at line 21. Execution of aborted due to compilation errors.