in reply to Help with Variable Scope

You're getting the package variable @output, not your lexical. If you'd used strict you'd have gotten scolded for doing so.

The cake is a lie.
The cake is a lie.
The cake is a lie.