proc add_human { name age } { global allHumans set human(name) $name set human(age) $age set allHumans([gen_id $human]) $human } proc list_humans { global allHumans foreach h in [array names $allHumans] { set human $allHumans($h) set name $human(name) ;# can't read "human(name)": variable isn't array } } proc gen_id { human } { #do something useful and return an id }