Your copy of the @vals array may be copying an undefined value so perhaps you should check the values before setting them in the new array.
for my $i (0..$#vals){
$tot_mem[$i]=$vals[$i][1]?$vals[$i][1]:0;
}
print "Good ",qw(night morning afternoon evening)[(localtime)[2]/6]," fellow monks."