use strict; use warnings; <> =~ / /; my $count; for($`..$'){ ++$count if(!(($`+$_+$')%3)); } print $count;