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

Re: value of a key pointed by (P) ?



On Sep 15, 10:17pm, Marc Chantreux wrote:
} Subject: Re: value of a key pointed by (P) ?
}
} le 15/09/2006,
} Peter Stephenson nous écrivait :
} > The expression generated by ${(P)b} is passed back as an ordinary array,
} 
} isn't it a bug?

No, it's not.  ${(P)b} is "the value of the thing named by the value of
b" and the value of the parameter a is an ordinary array consisting of
all the values of the associative array.

What you want are name references, that is, "the thing named by the
value of b" (note the difference -- missing one "value of").  Zsh
doesn't have those yet, and when it does they probably won't be
implemented via parameter expansion flags.

Also consider:

    b="a[$k]"
    print ${(P)b}



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