use 5.012;
use warnings;
sub hundred {
my @list = @_;
my $i = 0;
my $start = $i;
($start < @list) or return (); my $sum = 0;
while(($i < @list) and (($sum += $list[$i]) <= 100)){
$i++;
}
return @list[$start .. $i - 1]; };
}
say "@a";
my $h = hundred(@a);
while((my @list = $h->()) > 0){
say "@{[sum(@list)]} : @list";
}
dXNlIDUuMDEyOwp1c2Ugd2FybmluZ3M7CnVzZSBMaXN0OjpVdGlsIHF3KHN1bSk7CgpzdWIgaHVuZHJlZCB7CiAgICBteSBAbGlzdCA9IEBfOwoJbXkgJGkgPSAwOwoJcmV0dXJuIHN1YiB7CgkJbXkgJHN0YXJ0ID0gJGk7CgkJKCRzdGFydCA8IEBsaXN0KSBvciByZXR1cm4gKCk7CgkJbXkgJHN1bSA9IDA7CgkJd2hpbGUoKCRpIDwgQGxpc3QpIGFuZCAoKCRzdW0gKz0gJGxpc3RbJGldKSA8PSAxMDApKXsKCQkJJGkrKzsKCQl9CgkJcmV0dXJuIEBsaXN0WyRzdGFydCAuLiAkaSAtIDFdOwoJfTsKfQoKbXkgQGEgPSBtYXB7IGludChyYW5kKDEwKSkgKyAxIH0gKDEgLi4gNTApOwpzYXkgIkBhIjsKCm15ICRoID0gaHVuZHJlZChAYSk7CndoaWxlKChteSBAbGlzdCA9ICRoLT4oKSkgPiAwKXsKCXNheSAiQHtbc3VtKEBsaXN0KV19IDogQGxpc3QiOwp9Cg==