in reply to chapters,sentences, and arrays

hi, you can do this using just a single array.
my @a=(15,24,23,110,30,58,3,22,79,6); my $wantedSentence = 250; my $chptr = 1; foreach (@a) { $wantedSentence -= $_; if ($wantedSentence <= 0) { print "$chptr"; last; } $chptr++; }