#!/usr/bin/perl use warnings; use strict; use feature qw{ say }; my ($START, $END, $SIZE) = (1, 1524, 150); my @range; while (my $line = ) { my ($pos, $from, $to) = split / |\.\./, $line; if ($START == $from && $END == $to) { @range[$pos .. $SIZE + $pos - 1] = (1) x $SIZE; } } say scalar grep $_, @range; __DATA__ 46 1..1524 832 1..1524 1008 1..1524 1407 1..1524 2360 2052..3260 2967 2052..3260 403 1..1524 800 1..1524 2986 2052..3260 3170 2052..3260