Yes, you could avoid temp withAgreed. If I won't have a clue what I was doing in six months then KISS is best.set -A "${${(P)1}[pages]}[2]" 50 set -A "${${(P)1}[pages]}[3]" 100 set -A "${${(P)1}[pages]}[4]" 150 but that's not as clear or easily maintainable. You could also do
Once I have this running -- the real function -- I'll try that.temp=${${(P)1}[pages]} # Note one less (P) and not an array set -A "${temp}[2]" 50 set -A "${temp}[3]" 100 set -A "${temp}[4]" 150
or even set -A "${temp}[2,4]" 50 100 150
No, because in the real function there's work to determine what
the values will be, they can't be assigned ahead of time.