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

get keys of an associative array?



Hi,

I've KSH_ARRAYS (beside KSH_GLOB KSH_TYPESET KSH_OPTION_PRINT) set,
however, getting the key set of an array via ${!vname[@]} (as usually
done within ksh or bash) does not work (bad substitution). Couldn't find
anything else, except the @k flag, but this doesn't work as well, e.g.

unset A; typeset -A A; A['a']=1; A['b']=2; A['c']=3 ; print "${(@k)A}"

should print 'a b c' but prints '3'. Bug, feature? Hmmm, any hints?

Thanx,
jel.
-- 
Otto-von-Guericke University     http://www.cs.uni-magdeburg.de/
Department of Computer Science   Geb. 29 R 027, Universitaetsplatz 2
39106 Magdeburg, Germany         Tel: +49 391 67 52768



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