my %hash;
$hash{A}{A} = 1;
$hash{A}{B} = 2;
$hash{B}{A} = 4;
$hash{B}{B} = 8;
foreach my $k (keys %{$hash{B}}) {
print "$k - $hash{B}{$k}\n";
}
####
#include ##
using System;
using System.Collections.Generic;
using System.Collections;
using System.Text;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
Hashtable hash = new Hashtable();
hash.Add("A", new Hashtable());
((Hashtable)hash["A"]).Add("A", 1);
((Hashtable)hash["A"]).Add("B", 2);
hash.Add("B", new Hashtable());
((Hashtable)hash["B"]).Add("A", 4);
((Hashtable)hash["B"]).Add("B", 8);
foreach (string k in ((Hashtable) hash["B"]).Keys)
{
Console.WriteLine(k + " - " + ((Hashtable) hash["B"])[k]);
}
}
}
}
####
my %hash;
%hash{"A"}{"A"} = 1;
%hash{"A"}{"B"} = 2;
%hash{"B"}{"A"} = 4;
%hash{"B"}{"B"} = 8;
for %hash{"B"}.kv -> $key, $value {
say "$key - $value"
}
####
using System;
using System.Collections.Generic;
using System.Collections;
using System.Text;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
Dictionary> hash2 = new Dictionary>();
hash2.Add("A", new Dictionary());
hash2["A"].Add("A", 1);
hash2["A"].Add("B", 2);
hash2.Add("B", new Dictionary());
hash2["B"].Add("A", 4);
hash2["B"].Add("B", 8);
foreach (string k in hash2["B"].Keys)
{
Console.WriteLine(k + " - " + hash2["B"][k]);
}
}
}
}