Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: How to iterate over an array of associative arrays



On Jul 14,  9:57pm, Thorsten Kampe wrote:
}
} Say I have...
} 
} AssocArr1=(key1 value11
}            key2 value12)
} 
} AssocArr2=(key1 value21
}            key2 value22)
} 
} So how do I iterate over...
} 
}     array=(AssocArr1 AssocArr2)

Using the example in my earlier email ...

for ref in $array
do
   print ${${(P)ref}[${${(@kP)ref}[(i)key2]}]}
done



Messages sorted by: Reverse Date, Date, Thread, Author