Rascal schreef:
> The output of the following script:
>
> #!/usr/bin/perl -w
> @array = [0, 1, 2, 3];
> $hash{0} = @array;
> print "array = @array\n";
> print "hash = ", $hash{0}, "\n";
>
> is:
>
> array = ARRAY(0x8d13c20)
> hash = 1
>
> I expected the results to be the same. Why aren't they?
If you are looking for stringification of an array, try
$hash{0} = "@array";
If you are interested in the length of the array, try
printf "array = %s\n", scalar @array;
Also run and study this:
#!/usr/bin/perl
use strict;
use warnings;
my $array = [6, 7, 8, 9];
my %hash;
$hash{0} = $array;
print "array = @{$array}\n";
print "hash = ", @{$hash{0}}, "\n";
print "hash = @{$hash{0}}\n";
__END__
after reading perlref.
--
Affijn, Ruud
"Gewoon is een tijger."
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/