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

associative arrays: k flag in subscripts



Hi!

Consider this example (executed in a zsh without any configuration
done):

    zsh> local -A a
    zsh> a=('[0-9]' digit '[0-9a-z]' alnum)
    zsh> print $a[(k)3]
    digit alnum
    zsh> print $a[(K)3]
    digit alnum

Actually, I expected the output "digit alnum" when I specified the K
flag. But the k flag should behave differently, according to the
manual: ``... and returns the value for the first key found where
exp is matched by the key.''

So the expression $a[(k)3] should expand to either "digit" or "alnum",
not to both -- right?

Julius



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