I could get to work by rewriting it as "1while foo" or "1until!foo".
That loop will stop as soon as foo() returns false. The quiz didn't specify that foo() will always return a true value, so you can't assume it.
I wanted to explore how Perl's closures can be manipulated, and ended up creating an object system by accident.
Note: All code is untested, unless otherwise stated