zsh-users
 help / color / mirror / code / Atom feed
From: "Com MN PG P E B Consultant 3" <mn-pg-p-e-b-consultant-3.com@siemens.com>
To: "DervishD" <zsh@dervishd.net>
Cc: "zsh-users Mailinglist" <zsh-users@sunsite.dk>
Subject: RE: Associative Arrays don't work
Date: Mon, 24 Apr 2006 11:28:00 +0200	[thread overview]
Message-ID: <6F0CB04509C11D46A54232E852E390AC013D97F2@MCHP7R6A.ww002.siemens.net> (raw)

>  * Com MN PG P E B Consultant 3 
> <mn-pg-p-e-b-consultant-3.com@siemens.com> dixit:
> > $ zz=()       # According to zsh doc, should created any 
> array, including associative 
> 
>     I can't find where is that said. 

Having reread http://zsh.sunsite.dk/Doc/Release/zsh_14.html#SEC72 again,
I now see
that we have two contradicting statements about this. The first one is
exactly
like you said:

> 
On the contrary, what I've found
> is this:
> 
>     "Associative arrays _must_ be declared before assignment..."

The second information, further down this section, says:

"To create an empty array (including associative arrays), use one of: 
   set -A name 
   name=()"

When I saw the "use one of", I was happy enough to not read the whole
section verbatim.
Hence, I had chosen the "name=()" form, believing that it would be
sufficient. 

I now see that I has mistakingly believed that creation of an
associative array could
be done without declaring it.

>     Try this:
> 
>     $ typeset -A zz
>     $ zz[f]=4
>     $ zz[g]=5
>     $ print "Here goes zz[f] =>$zz[f] and here zz[g] =>$zz[g]"
>     Here goes zz[f] =>4 and here zz[g] =>5
> 
>     Hope this helps ;) (tested under 4.2.6, BTW)

It does, indeed. Thank you very much!

Ronald
-- 
Ronald Fischer (phone +49-89-63676431)
mailto:mn-pg-p-e-b-consultant-3.com@siemens.com


             reply	other threads:[~2006-04-24  9:29 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-04-24  9:28 Com MN PG P E B Consultant 3 [this message]
2006-04-25  9:42 ` DervishD
  -- strict thread matches above, loose matches on Subject: below --
2006-04-24  8:31 Com MN PG P E B Consultant 3
2006-04-24  8:48 ` DervishD

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=6F0CB04509C11D46A54232E852E390AC013D97F2@MCHP7R6A.ww002.siemens.net \
    --to=mn-pg-p-e-b-consultant-3.com@siemens.com \
    --cc=zsh-users@sunsite.dk \
    --cc=zsh@dervishd.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).