my @quans = (2, 5, 8, 12, 15, 88); my $total = scalar(map {1 .. $_} @quans); print "$total.\n";