From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 23574 invoked from network); 15 Sep 2006 17:56:47 -0000 X-Spam-Checker-Version: SpamAssassin 3.1.5 (2006-08-29) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.4 required=5.0 tests=AWL,BAYES_00, FORGED_RCVD_HELO autolearn=ham version=3.1.5 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by ns1.primenet.com.au with SMTP; 15 Sep 2006 17:56:47 -0000 Received-SPF: none (ns1.primenet.com.au: domain at sunsite.dk does not designate permitted sender hosts) Received: (qmail 13761 invoked from network); 15 Sep 2006 17:56:39 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 15 Sep 2006 17:56:39 -0000 Received: (qmail 16290 invoked by alias); 15 Sep 2006 17:56:32 -0000 Mailing-List: contact zsh-users-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 10719 Received: (qmail 16281 invoked from network); 15 Sep 2006 17:56:31 -0000 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by sunsite.dk with SMTP; 15 Sep 2006 17:56:31 -0000 Received: (qmail 12713 invoked from network); 15 Sep 2006 17:56:31 -0000 Received: from cluster-d.mailcontrol.com (217.69.20.190) by a.mx.sunsite.dk with SMTP; 15 Sep 2006 17:56:30 -0000 Received: from cameurexb01.EUROPE.ROOT.PRI ([62.189.241.200]) by rly04d.srv.mailcontrol.com (MailControl) with ESMTP id k8FHuTHj026169 for ; Fri, 15 Sep 2006 18:56:30 +0100 Received: from news01.csr.com ([10.103.143.38]) by cameurexb01.EUROPE.ROOT.PRI with Microsoft SMTPSVC(6.0.3790.1830); Fri, 15 Sep 2006 18:56:29 +0100 Date: Fri, 15 Sep 2006 18:56:28 +0100 From: Peter Stephenson To: zsh-users@sunsite.dk Subject: Re: value of a key pointed by (P) ? Message-Id: <20060915185628.4641deb7.pws@csr.com> In-Reply-To: <20060915174734.GA14349@ulpmm.u-strasbg.fr> References: <20060915174734.GA14349@ulpmm.u-strasbg.fr> Organization: Cambridge Silicon Radio X-Mailer: Sylpheed version 2.2.6 (GTK+ 2.6.7; i686-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-OriginalArrivalTime: 15 Sep 2006 17:56:29.0562 (UTC) FILETIME=[457405A0:01C6D8F0] X-Scanned-By: MailControl A-07-04-01 (www.mailcontrol.com) on 10.68.0.114 Marc Chantreux wrote: > typeset -A a > a=( > this is > something special > for you > ) > b=a > k=this > print ${${(P)b}[$k]} > > i expect 'is', i get 'you'. Why ? how to fix ? The expression generated by ${(P)b} is passed back as an ordinary array, so it isn't indexed properly by the $k. I don't think there's an easy answer; you have to resort to something like eval print '${'$b'[$k]}' -- Peter Stephenson Software Engineer CSR PLC, Churchill House, Cambridge Business Park, Cowley Road Cambridge, CB4 0WZ, UK Tel: +44 (0)1223 692070 To access the latest news from CSR copy this link into a web browser: http://www.csr.com/email_sig.php