From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 21543 invoked from network); 26 May 2006 15:40:46 -0000 X-Spam-Checker-Version: SpamAssassin 3.1.1 (2006-03-10) 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.1 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by ns1.primenet.com.au with SMTP; 26 May 2006 15:40:46 -0000 Received: (qmail 55431 invoked from network); 26 May 2006 15:40:39 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 26 May 2006 15:40:39 -0000 Received: (qmail 26 invoked by alias); 26 May 2006 15:40:33 -0000 Mailing-List: contact zsh-users-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 10314 Received: (qmail 16 invoked from network); 26 May 2006 15:40:32 -0000 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by sunsite.dk with SMTP; 26 May 2006 15:40:32 -0000 Received: (qmail 54499 invoked from network); 26 May 2006 15:40:32 -0000 Received: from cluster-d.mailcontrol.com (217.69.20.190) by a.mx.sunsite.dk with SMTP; 26 May 2006 15:40:30 -0000 Received: from cameurexb01.EUROPE.ROOT.PRI ([62.189.241.200]) by rly28d.srv.mailcontrol.com (MailControl) with ESMTP id k4QFeS3R016601 for ; Fri, 26 May 2006 16:40:28 +0100 Received: from news01.csr.com ([10.103.143.38]) by cameurexb01.EUROPE.ROOT.PRI with Microsoft SMTPSVC(6.0.3790.1830); Fri, 26 May 2006 16:39:48 +0100 Received: from news01.csr.com (localhost.localdomain [127.0.0.1]) by news01.csr.com (8.13.4/8.13.4) with ESMTP id k4QFeScr007576 for ; Fri, 26 May 2006 16:40:28 +0100 Received: from csr.com (pws@localhost) by news01.csr.com (8.13.4/8.13.4/Submit) with ESMTP id k4QFeReG007573 for ; Fri, 26 May 2006 16:40:28 +0100 Message-Id: <200605261540.k4QFeReG007573@news01.csr.com> X-Authentication-Warning: news01.csr.com: pws owned process doing -bs To: zsh-users@sunsite.dk Subject: Re: Keying arrays to names: is there an array of arrays? In-reply-to: <44771E3E.9070102@ulpmm.u-strasbg.fr> References: <44771E3E.9070102@ulpmm.u-strasbg.fr> Comments: In-reply-to Marc Chantreux message dated "Fri, 26 May 2006 17:26:54 +0200." Date: Fri, 26 May 2006 16:40:27 +0100 From: Peter Stephenson X-OriginalArrivalTime: 26 May 2006 15:39:48.0396 (UTC) FILETIME=[9EE966C0:01C680DA] Content-Type: text/plain MIME-Version: 1.0 X-Scanned-By: MailControl A-07-00-01 (www.mailcontrol.com) on 10.68.0.138 Marc Chantreux wrote: > > Second, I'd like to ask if it's possible to key an array to a name? > > % typeset -A a > % a[a]='those are values' > % print -l ${(s: :)a[a]} > those > are > values This reminds me I was going to post a general solution along the same lines which deals with embeded spaces etc.: % array=(one 'two three' '"four five six"') % typeset -A hash % array=(${(q)array}) % hash[key]="${array}" % array=(${(Q)${(z)hash[key]}}) % print -r $array one two three "four five six" I couldn't work out how to do the encoding in a single step, since "${(q)array}" and all the variants of it I could think of quote the spaces that are to be used as separators. -- 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