in reply to perl task3

May be you could be so kind as to indicate which lines are "52,54,56,58.." so we do not have to count them ourselves?

If it are the splits in the foreach loop, did you check if $value and @elements contain what you expect them to contain? As we do not know what is in %sequences it is difficult to guess, but perhaps

(my $key, my $value) = %sequences
should be
(my $key, my $value) = each %sequences
OP changed the code after I wrote my answer.

CountZero

A program should be light and agile, its subroutines connected like a string of pearls. The spirit and intent of the program should be retained throughout. There should be neither too little or too much, neither needless loops nor useless variables, neither lack of structure nor overwhelming rigidity." - The Tao of Programming, 4.1 - Geoffrey James