我想开始一个数组哈希并打印出值。我试过这个:
#!/usr/bin/perl
use strict;
use warnings;
my %hash = (
one=> [ 'a', 'b', 'c', ],
two => [ 'd', 'e', 'f', ],
three => [ 'g', 'h', 'i', ],
);
foreach my $number (keys %hash) {
print "Array: $number = ";
foreach (@{$hash{$number}}) {
print "$_\t\n";
}
}
Array: three = g
h
i
Array: one = a
b
c
Array: two = d
e
f
但我想要:
Array1 a b c
Array2 d e f
Array3 g h i
谁能帮我吗?