diff --git a/books.pl b/books.pl index 14bff34..edb64d3 100755 --- a/books.pl +++ b/books.pl @@ -206,6 +206,9 @@ for ( my $l; $l < $number_of_pages; $l++){ # pull out a random chapter from that book my $chapter_select = int(rand($chapter_list)); + # pop off the last page, as it may be blank, or short + pop @{$books[$book_list]{'pages'}[$chapter_select]}; + # get the number of pages in the chapter my $page_list = @{$books[$book_list]{'pages'}[$chapter_select]}; # pull out a random page from the chapter