On Sat, 30 Jul 2005, Louis Pouzin wrote:
I could replace the array with a 2-key hash. Somewhat funny, but maybe a
solution.
$H{$ip}{nam} = {$nam1,'',$nam2,'',$nam3,''};
$H{$ip}{dom} = {$dom1,'',$dom2,''}; # and later
$H{$ip}{nam}{$nam4}=''; # this works
Yes, that's the way I would do it. I find almost without exception that
the data structure I wanted was a hash, not an array. In your first
example, you were embedding/obscuring a piece of knowledge (0 => nam, 1 =>
dom). Over time, I've found it more readable to make that relationship
explicit. As a bonus, you can expand it whenever you want, reorder it,
etc.
--
MattLangford