in reply to How to Save a variable outside of a loop

By declaring your variables inside the loop, they are being redeclared each time the loop executes.

If you move your declarations before the loop, it should work:

#!/usr/bin/perl use warnings; use strict; my $hitlength; my $prevalence; my $prev_l; my $prev_p ; while(<>){

Replies are listed 'Best First'.
Re^2: How to Save a variable outside of a loop
by Calebros (Initiate) on Jul 31, 2015 at 22:12 UTC
    Thank you very much Ron, you saved me a lot of hair pulling!