foreach my $i (0..$#lines) { my $k1 = get_key( (($i >> 6) & 7) * 6 + 17 ); my $k2 = get_key( (($i >> 3) & 7) * 6 + 17 ); my $k3 = get_key( ($i & 7) * 6 + 17 ); my $frag = $lines[$i]; $frag_id{$frag} ||= shift @keys; $map{$i} = [ $frag_id{$frag}, $k1, $k2, $k3 ]; }
sub get_key { my($bin) = @_; my $word = shift @keys; $used{$word} = $bin; return $word; }