in reply to last in do vs last in while/for

When things don't behave like you think they should, reading the docs sometimes helps:
"last" cannot be used to exit a block which returns a value such as "eval {}", "sub {}" or "do {}", and should not be used to exit a grep() or map() operation.