this script pick up a file and steps through it, and then picks up another file and matches the item number to merge the file and i getting this error, and I do not know why ?
here is the code where the file is blowing up with the following errors repeatedly.
<Error>
substr outside of string at ./parseOsc.pl line 272, <PLUS> line 745800.
substr outside of string at ./parseOsc.pl line 273, <PLUS> line 745800.
Use of uninitialized value $bo_plus in substitution (s///) at ./parseOsc.pl line 283, <PLUS> line 745800.
Use of uninitialized value $res_plus in substitution (s///) at ./parseOsc.pl line 284, <PLUS> line 745800.
Use of uninitialized value $res_plus in string eq at ./parseOsc.pl line 286, <PLUS> line 745800.
Use of uninitialized value $bo_plus in string eq at ./parseOsc.pl line 287, <PLUS> line 745800.
</Error>
<code>
while(<PLUS>) {
$the_plus = $_;
chomp($the_plus);
$item_plus = substr($the_plus, 0,10);
$bo_plus = substr($the_plus,36, 5);
$res_plus = substr($the_plus,41, 5);
next if $item_plus =~ m/\s*MSC/i;
$item_plus =~ s/\s+//;
next if $item_plus eq "";
#print " $item >$item_plus< \t $bo_plus \t $res_plus \n";
$bo_plus =~ s/\s+//; ### Error happens here !!!
$res_plus =~ s/\s+//; ### Error happens here !!!
$res_plus = ($res_plus eq "" ) ? '0' : $res_plus;
$bo_plus = ($bo_plus eq "" ) ? '0' : $bo_plus;
next if ( $item ne $item_plus);
if ( $item eq $item_plus ) {
#$comingSoon = (( $onhand + $transit) - ( $res_plus + $bo_plus ));
$comingSoon = (($transit) - ( $res_plus + $bo_plus ));
if ( $comingSoon > 0 ) {
$csoon = "Available < 35 days (" . $comingSoon .")";
} else { $csoon = ""; }
# print "$comingSoon \t $onhand \t $transit \t $res_plus \t $bo_plus \n";
}
}
Any Help would be appreciated !
thanks in advance