From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 4412 invoked by alias); 7 Nov 2015 16:11:20 -0000 Mailing-List: contact zsh-users-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Users List List-Post: List-Help: X-Seq: 20918 Received: (qmail 6704 invoked from network); 7 Nov 2015 16:11:19 -0000 X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM, T_DKIM_INVALID autolearn=ham autolearn_force=no version=3.4.0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:content-type; bh=4kDqTwxzCGhv6ZMiGDfLyYUb0zgN69pGin5oaBzpImc=; b=rTyirk68QE/8LgwLeq/MDUIpzNQh2Z8Q4n4R89jjYOktwu/7GcNN9cQTI3aTQoRil0 dUZxodnURi8C3rLC7R+a1JlhQ1f6uYk2KlVEjagnYrLeO+Yxt1Sr+aOzQQ951VpPe8CZ GX+/fjvH6b5q9sub/fOVgEKo1IOyn6M8VlarGV87rfNxp6DUfaUbKhzYF15gE8sRn5r9 DdUMeif/gmDNGPCssZFG4MW2vxkzAXWR7BN2ICak+EzELtDEh17QvMttBXL+wE+p73lb 1a+spb7NYoMm8PvbX8sbKt4qzc0sTBTNdq8dy/npY6qfdDm/VT6h5cxpkYB9jb8uKxlo 4A8w== MIME-Version: 1.0 X-Received: by 10.25.26.210 with SMTP id a201mr6124754lfa.58.1446912674644; Sat, 07 Nov 2015 08:11:14 -0800 (PST) Date: Sat, 7 Nov 2015 17:11:14 +0100 Message-ID: Subject: How to preserve order of associative array? From: Dominik Ritter To: zsh-users@zsh.org Content-Type: text/plain; charset=UTF-8 Hi everyone! I struggle to the order of an associative array right. If I take the example from zsh-lovers man page: $ typeset -A ass_array; ass_array=(one 1 two 2 three 3 four 4) $ print ${(k)ass_array} # prints keys one four two three $ print ${(v)ass_array} # prints values 1 4 2 3 I would expect that to be the keys sorted as they appear in the array (one, two, three, four). I tried to sort them in array index order, but without luck: print ${(ak)ass_array} The other sort-modifiers won't help me, as I need a hierarchy in my array keys (neither lexically, nor numerical). Thanks for any help. Regards, Dominik