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
Post a Comment