From 86f6396bdb1e300a51ca120e65a375442b31653e Mon Sep 17 00:00:00 2001 From: Jacob Haddon Date: Sat, 9 Nov 2024 18:34:35 -0500 Subject: [PATCH] aded a pop function to the pages to help prevent short or blank pages. --- books.pl | 3 +++ 1 file changed, 3 insertions(+) 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