in your
while loop,
$_ is only the current line of the file in
QUESTIONS - the globbing operator doesn't know that you are using a different delimiter than just a \n.
Insta-update: sorry to insult your intelligence - reviewing the following nodes I finally understood what the input record separator does... which was nice for me but not much help to you. So I now realise that my solution may be a good solution, but it's not a solution to the real problem. But here, for the benefit of a laughing posterity, it is:
Unless memory is a constraint or
questions is a really huge file, I think the simplest solution would be to read the whole file into a scalar, and then split it into an array of questions with
@questions = split (/===\n/, $scalar).
Then you can run your loop, but instead of
while (<QUESTIONS>) {
you would use
for (@questions) {
§
George Sherston