# $Id: hash2.parrot,v 1.0 2002/08/19 17:25:00 dada Exp $ # http://dada.perl.it/shootout/ set I1, P0[1] set I2, 0 new P1, .PerlHash new P11, .PerlArray set P11, 10000 HASH1: set S0, "foo_" set S1, I2 concat S0, S1 set P1[S0], I2 set P11[I2], S0 inc I2 lt I2, 10000, HASH1 new P2, .PerlHash set I0, 1 HASH2: set I3, P11 set I2, 0 HASH1_KEYS: set S0, P11[I2] set I4, P1[S0] set I5, P2[S0] add I5, I4 set P2[S0], I5 inc I2 le I2, I3, HASH1_KEYS inc I0 le I0, I1, HASH2 set S0, "foo_1" set I0, P1[S0] set S1, I0 print S1 print " " set S0, "foo_9999" set I0, P1[S0] set S1, I0 print S1 print " " set S0, "foo_1" set I0, P2[S0] set S1, I0 print S1 print " " set S0, "foo_9999" set I0, P2[S0] set S1, I0 print S1 end