Python searches through three and a bit levels of scope, while perl lexicals are telescopic. In python there is the local scope, the module scope, and builtin scope.
my  $map;
sub b {
    my $map;
    while (1){
        my $map;
        if (1){
            my $map;
            # four different $map's
#builtin map is a function 
map = 1 #module or global level
def func:
    map = 2 #local to this function
    if 1:
        map = 3 #still function level

def func2:
    x = map # no map in this scope
            # falls through
def func3:
    global map
    map = 2 #changing global map.

Python scopes are implemented as python dictionaries and can be accessed via obj.__dict__.