
8840
New User
Oct 14, 2008, 3:42 PM
Post #1 of 2
(3794 views)
|
use of unitialised value problem
|
Can't Post
|
|
Dear Perl veterans, I have had this problem with my perl code the past two months. The soubroutine is a part of a larger program and everytime I run it I receive the warning message that there is an uninitialised value in the marked lines. I have tried to debug this for several weeks, re-writing the code but the warning message is persistent. The entire program runs and returns most of the time a desired output (at least what I think is) but sometimes fails to return an output. Many thanks in advance for any help. The two subroutines basically do the same thing with numbers and letters. sub number_segmentor { my @s = @_; chomp @s; my @array; for (my $gen = 15; $gen > 11; $gen--) { my $length = @s; my $position = '0'; while ($position < $length) { my $count = $position + $gen; my $p = 0; ($p += $_) for $seq[$position..$count]; #Unitialised value detected at this position, doesn't specify which variable unless($position + $gen > $length) {push (@array, $p);} $position++; } } return @array; } sub letter_segmentor { my @seq = @_; chomp @seq; my $length = @seq; my @array; my $antigen; my $peptide; my $position = 0; for (my $gen = 15; $gen > 11; $gen--) { while ($position < $length) { my $count = $position + $antigen; my $p = $seq[$position...$count]; #Unitialised value detected at this position, doesn't specify which variable if (length($p) == $gen) {push (@array, $p);} $position++; } } return @array; }
|