Correct, package variables live until perl exits, or the variable is explicitly destroyed. If you want shorter lived variables then you'll want to be using
lexical variables who's life-span is tied to the length of the surrounding lexical scope (unless they're referenced from a higher scope). For more information on lexical variables see.
Lexical scoping like a fox.