From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 9184 invoked from network); 11 Nov 1998 20:03:33 -0000 Received: from math.gatech.edu (list@130.207.146.50) by ns1.primenet.com.au with SMTP; 11 Nov 1998 20:03:33 -0000 Received: (from list@localhost) by math.gatech.edu (8.9.1/8.9.1) id PAA07965; Wed, 11 Nov 1998 15:00:41 -0500 (EST) Resent-Date: Wed, 11 Nov 1998 15:00:41 -0500 (EST) To: Bruce Stephens Cc: zsh-workers@math.gatech.edu (Zsh hackers list) Subject: Re: PATCH: 3.1.5 - sample associative array implementation References: <9811111358.AA51361@ibmth.df.unipi.it> Mime-Version: 1.0 (generated by tm-edit 7.108) Content-Type: text/plain; charset=US-ASCII From: Timothy Writer Date: 11 Nov 1998 15:00:47 -0500 In-Reply-To: Bruce Stephens's message of "11 Nov 1998 14:43:21 +0000" Message-ID: X-Mailer: Gnus v5.5/XEmacs 20.4 - "Emerald" Resent-Message-ID: <"NwxXC.0.Oy1.fpUIs"@math> Resent-From: zsh-workers@math.gatech.edu X-Mailing-List: archive/latest/4603 X-Loop: zsh-workers@math.gatech.edu Precedence: list Resent-Sender: zsh-workers-request@math.gatech.edu Bruce Stephens writes: > Peter Stephenson writes: > > > This can probably be fixed in a perl-like fasion by adapting > > setarrvalue(), which should be reasonably painless, though I haven't > > looked at the details yet. One question is whether > > hash=(key1 val1 key2 val2) > > replaces the array entirely, or just adds/replaces those elements. In > > the former case it's difficult to think of a way of replacing multiple > > elements at once; maybe another new typeset flag. > > What does ksh93 provide in the way of associative array functionality? > (I don't have it installed at work, so I can't look it up right not.) In ksh93 associative arrays are declared using "typeset -A". They use the same syntax as indexed arrays, e.g. "foo[bar]=baz"; the text within [] is subject to variable expansion and whitespace counts. The following special notation is used to get all keys: "${!arrayname[@]}" -- Tim Writer Tim.Writer@ftlsol.com FTL Solutions Inc. Toronto, Ontario, CANADA