http://www.perlmonks.org?node_id=680567


in reply to Printing a Variable outside of the block

You need to declare your variables in the outermost scope you want to use them in. Since you want to use them outside the block, you should declare them outside (before) the block.

Caution: Contents may have been coded under pressure.