perl - Access nested hash and subroutine -


consider following code snippet:

#global space here {     #nested here     %hash = (         key1 => 'a',         key2 => 'b',         key3 => 'c',         key4 => 'd',     );      sub test     {         #subroutine code goes here     } } 

how access either hash or subroutine global scope when nested within curly braces?

the hash lexically scoped block (the curly braces), can accessed inside block. subroutine can accessed anywhere, regardless of scope.


Comments

Popular posts from this blog

python - Subclassed QStyledItemDelegate ignores Stylesheet -

java - HttpClient 3.1 Connection pooling vs HttpClient 4.3.2 -

SQL: Divide the sum of values in one table with the count of rows in another -