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

Re: Keying arrays to names: is there an array of arrays?



Peter Stephenson <pws@xxxxxxx> writes:

> This reminds me I was going to post a general solution along the same
> lines which deals with embeded spaces etc.:

Is it possible to abstract that trick into functions?  That is, so the
function takes the array name, key, and value as arguments?  My feeble
attempts have failed.

> % array=(one 'two three' '"four five six"')
> % typeset -A hash
> % array=(${(q)array})
> % hash[key]="${array}"
> % array=(${(Q)${(z)hash[key]}})
> % print -rl $array
> one
> two three
> "four five six"


Johann

-- 
johann myrkraverk com (you know the drill with the @ and .)
I classify Outlook mail as spam, use something else.



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