jsb@cs.brown.edu (John Bazik) (07/20/90)
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