in reply to Use of uninitialized value in subroutine entry at /home/roarce/perl5/perlbrew/perls/perl-5.28.0/lib/site_perl/5.28.0/Seeder/Finder.pm line 476, <IN> line 8192.

Looking at the source, the message "<IN> line 8192." is irrelevant if not misleading because IN was never closed as it should. In sub _read_bkgd(). So, all subsequent warns report it and rightly so as it is still open, alas they are irrelevant.

Line 476 of the source file is:

sub _get_seed { my $self = shift; my $n_bkgd_seq = List::Util::sum( @{ $self->{bkgd_ref}->[0] } ); my @hd_sum; for my $oligo_indice ( 0 .. $#{ $self->{oligo_ref} } ) { $hd_sum[$oligo_indice] = List::Util::sum( @{ $self->{hd_matrix_ref}->[$oligo_indice +] } ); # 476 }

Which suggests that there is something wrong with $self->{hd_matrix_ref}->[$oligo_indice]. Either $self->{hd_matrix_ref} is not an arrayref or if it is, the index $oligo_indice exceeds its size, or $self->{hd_matrix_ref}->[$oligo_indice] is not an arrayref. The construction of $self->{hd_matrix_ref} is done in line 325 (sub _build_hd_matrix).

From a glance at line 325, I think the first and second hypotheses can be ruled out because the index spans the exact same range as in line 476, that is:

for my $oligo_indice ( 0 .. $#{ $self->{oligo_ref} } ) {

That is, the array has correct dimensions but may contain "holes" or has undef in its 2D span. (Edit: by "holes" i mean array elements which were never set to a value, as opposed to the "undef" which means array elemets were set to an undef value which was the result of a calculation/transformation which went wrong, and was not detected, or just bad input).

If you want to debug this, then perhaps you can add a couple of debug prints to see what's going on with that array. I would start just before line 387 (before return), with this (untested):

for my $oligo_indice ( 0 .. $#{ $self->{oligo_ref} } ) { print "index: $oligo_indice ("; for my $count_indice ( 0 .. $#{ $self->{count_matrix_ref} } ) { if( ! defined $hd_matrix[$oligo_indice][$count_indice] ){ die "prob +lem at [$oligo_indice][$count_indice]" } print $hd_matrix[$oligo_indice][$count_indice]."," } print "\n"; }

bw, bliako

  • Comment on Re: Use of uninitialized value in subroutine entry at /home/roarce/perl5/perlbrew/perls/perl-5.28.0/lib/site_perl/5.28.0/Seeder/Finder.pm line 476, <IN> line 8192.
  • Select or Download Code

Replies are listed 'Best First'.
Re^2: Use of uninitialized value in subroutine entry at /home/roarce/perl5/perlbrew/perls/perl-5.28.0/lib/site_perl/5.28.0/Seeder/Finder.pm line 476, <IN> line 8192.
by roarce92 (Acolyte) on Apr 29, 2020 at 22:06 UTC

    Thanks so much Bliako!

Re^2: Use of uninitialized value in subroutine entry at /home/roarce/perl5/perlbrew/perls/perl-5.28.0/lib/site_perl/5.28.0/Seeder/Finder.pm line 476, <IN> line 8192.
by roarce92 (Acolyte) on May 25, 2020 at 15:15 UTC

    Hi Bliako, sorry for the delay of time. I tried your suggestion and it did not work. Could you help me with other solution to that? I'd appreciate so much. Rocío

      Hi Rocio, start by inserting the above print statements I suggested to the relevant Perl file and report the output. Only you can sort this out because you have the data files and you can run them to see what the debugging messages report. One of those debugging messages will cause the program to exit if there are undefined values. So watch out for that too. See also if you can run it successfully with some datafiles and if yes, what's the difference between failed and successful data files. If you could also reduce the data files to the absolute minimum it would make debugging easier. Anyway, start by inserting those debug messages, run it and let us know.

        Thanks Bliako for your suggestions. I corrected the code as you said and it worked. Could you help me to understand the results? I have two similar files. For an input file which worked well, the output is:

        While another file which does not work generates this output:

        Both files have some different titles with the same length after them (1000 digits) What it means? Thank you in advance!

        2020-06-01 Athanasius added <code> tags.