I have a question, inspired by the "Random Quotes" mini-application, used as an example of writing to a file and reading from a file, in Chapter 11 of this book.
The "read from file" part of this application picks a random quote from an array, and outputs it to a web browser.
I want to figure out the simplest way to improve this script, so that the random quotes that it outputs are not repeated, as long as there are quotes left in the file.
For example, the script has output the array element # 0. I want it to remember that the element # 0 has been output, and the next time to output any other element of the array, but not 0 - and so on, until the script runs out of quotes, in which case it can start over again.
I'm not asking this for any important or practical reason, but I'm just curious, if a simple an elegant solution could be found.
Would appreciate a creative suggestion!