in reply to creating and printing a sliding window

Have a look at the List::Util core module, particularly the max() routine. Also be aware the array subscripts are zero-based so your

... my $pos = $data[1]; my $cons1 = $data[2]; my $cons2 = $data[3]; my $cons3 = $data[4]; my $cons4 = $data[5]; my $cons5 = $data[6]; ...

will be pointing one element too far to the right. You can also do that in one fell swoop.

while( <FILE> ) { my( $pos, $cons1, $cons2, $cons3, $cons4, $cons5 ) = split; ...

The default action for split is to split $_ on whitespace.

I hope this is helpful.

Cheers,

JohnGG