Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!uunet!brunix!jsb From: jsb@cs.brown.edu (John Bazik) Newsgroups: comp.lang.perl Subject: splitting multi-dimen keys Message-ID: <45348@brunix.UUCP> Date: 19 Jul 90 20:54:03 GMT Sender: news@brunix.UUCP Reply-To: jsb@cs.brown.edu (John Bazik) Organization: Brown University Department of Computer Science Lines: 23 After scratching my head for awhile, I came up with this brute-force subroutine for producing two regular arrays of the keys in a two-dimensional associative array: sub main'splitkeys{ local(*assoc,*projs,*fields) = @_; for (keys(%assoc)) { if (/(.*)$;(.*)/) { $projs{$1} = $2; $fields{$2} = $1; } else { print "splitkeys: bad key '$_'\n"; } } @projs = keys(%projs); @fields = keys(%fields); } Is this a reasonable approach, or am I missing out on some perl cleverness? John