From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 8557 invoked from network); 28 May 2006 02:14:06 -0000 X-Spam-Checker-Version: SpamAssassin 3.1.2 (2006-05-25) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.5 required=5.0 tests=BAYES_00,FORGED_RCVD_HELO autolearn=ham version=3.1.2 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by ns1.primenet.com.au with SMTP; 28 May 2006 02:14:06 -0000 Received: (qmail 50873 invoked from network); 28 May 2006 02:14:00 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 28 May 2006 02:14:00 -0000 Received: (qmail 5850 invoked by alias); 28 May 2006 02:13:52 -0000 Mailing-List: contact zsh-users-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 10320 Received: (qmail 5840 invoked from network); 28 May 2006 02:13:52 -0000 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by sunsite.dk with SMTP; 28 May 2006 02:13:52 -0000 Received: (qmail 49805 invoked from network); 28 May 2006 02:13:52 -0000 Received: from snaefell.rhi.hi.is (130.208.165.28) by a.mx.sunsite.dk with SMTP; 28 May 2006 02:13:51 -0000 Received: from jin.myrkraverk.com (a048.nemendur.hi.is [130.208.188.48]) by snaefell.rhi.hi.is (8.13.6/8.13.3) with ESMTP id k4S2Ddsc015498 for ; Sun, 28 May 2006 02:13:40 GMT Received: from jin.myrkraverk.com (localhost.localdomain [127.0.0.1]) by jin.myrkraverk.com (8.13.1/8.13.1) with ESMTP id k4S2YAZl029417 for ; Sun, 28 May 2006 02:34:11 GMT Received: (from myrkraverk@localhost) by jin.myrkraverk.com (8.13.1/8.13.1/Submit) id k4S2YAWj029416; Sun, 28 May 2006 02:34:10 GMT X-Authentication-Warning: jin.myrkraverk.com: myrkraverk set sender to johann@myrkraverk.com using -f Subject: Re: Keying arrays to names: is there an array of arrays? References: <44771E3E.9070102@ulpmm.u-strasbg.fr> <200605261540.k4QFeReG007573@news01.csr.com> <060527151044.ZM25448@torch.brasslantern.com> From: "Johann 'Myrkraverk' Oskarsson" To: ZSH Users Date: Sun, 28 May 2006 02:34:10 +0000 In-Reply-To: <060527151044.ZM25448@torch.brasslantern.com> (Bart Schaefer's message of "Sat, 27 May 2006 15:10:44 -0700") Message-ID: User-Agent: Gnus/5.1006 (Gnus v5.10.6) XEmacs/21.4 (Security Through Obscurity, linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Bart Schaefer writes: > I'll assume you mean the *associative* array (hash) name. Yes, thank you very much. > A function to do the assignment isn't too terrible, though there are > scoping issues -- either the hash already has to exist, or you can > only create it in the global scope by using typeset -g: The following version also works with IFS="" (I guess it will work with IFS equal to something sensible too). mapassign() { local h=$1 k=$2 shift 2 set -- ${(j: :q)*} typeset -gA $h typeset -g $h\[$k\]="$*" } > A function to read back the value is a bit trickier. What do you want > to do with the array once you have it? A common fallback would be to > stuff it in $reply: Same with this one: mapread() { set -- $1\[$2\] reply=( ${(s: :Q)${(z)${(P)1}}} ) } > Incidentally: > > } I classify Outlook mail as spam, use something else. > > Someone asking for assistance has no right to dictate terms. You want > my help, you take it the way I send it. I don't happen to use Outlook, > but next time I see something like this, I just won't answer. That isn't meant for mailing lists, but for private messages. I've modified my tag line a bit, but it's also your prerogative not to answer. -- johann myrkraverk com (you know the drill with the @ and .) I classify Outlook mail as spam, please use something else for private messages.