{ my %hash = (...); # operations on %hash here } # %hash doesn't exist here. Does that solve your problem?