in reply to Bioinformatics- Use of uninitialized value
I'm not a bio-guy, so just some general thoughts.
... error: Use of uninitialized value $_ in pattern match (m//) at /Users/.../Triple.pl line 66.
This is not an error, but a warning. Warnings are enabled by use-ing the warnings pragma, which the script you posted does not do. I don't see how you could get the quoted warning from the posted code (update: unless you're using the -w command-line switch to invoke your script — Ah-ha, I see it now in the shebang invocation: strike this comment).
c:\@Work\Perl\monks>perl -MData::Dump -le "use strict; ;; my $rx = 'x'; my @ra = grep !/$rx/, undef; dd \@ra; " [undef] c:\@Work\Perl\monks>perl -MData::Dump -le "use strict; use warnings; ;; my $rx = 'x'; my @ra = grep !/$rx/, undef; dd \@ra; " Use of uninitialized value $_ in pattern match (m//) at -e line 1. [undef]
my @third_fragments = grep !/$rsite3/, $second_fragments[$i];
grep operates on a list, but this statement has a list consisting only of the $second_fragments[$i] scalar, i.e., a single item. The @third_fragments array can then be initialized with only zero or one elements. I don't know if this was intended. Further, I don't offhand see any reason the @second_fragments array must contain $i + 1 elements; thus, you may be accessing an element that's "off the end" of the array and therefore undefined.
Update: Finally saw -w in shebang invocation, so strike entire first 'thought'.
|
|---|