for my $hElem (@{$matches{$element}{$sitekey}}) { next unless ($hElem >= $lowerlimit); break unless ($hElem <= $upperlimit); print "...in \$hElem\n" push (@arrayA, $hElem); }