in reply to Bioinformatics- Use of uninitialized value

I don't think you are doing what you intend to.
my @third_fragments = grep !/$rsite3/, $second_fragments[$i];
only checks the i'th element of the @second_fragments array, and $i is associated with @first_fragments. Perhaps you meant
my @third_fragments = grep !/$rsite3/, @second_fragments;

Also, you should be aware that the vast majority of your scalar invocations are unnecessary. <, - and most other operators enforce scalar context already. And you can count from the end of an array using negative indices, thus you could have written e.g.

$first_fragments[-1] = $rsite1.$first_fragments[-1];

#11929 First ask yourself `How would I do this without a computer?' Then have the computer do it the same way.

Replies are listed 'Best First'.
Re^2: Bioinformatics- Use of uninitialized value
by mlsmit10 (Initiate) on Jul 21, 2014 at 21:51 UTC

    I tried making the change you suggested, and the results don't make any sense. It gives me a number that is higher than the number I get if I run the same script without the grep function (and associated modifications) included. Should I define something similar to the $i defined for the first fragments for the second fragments? Thanks.