Ths initial assignment may not be necessary, at least in some versions of
Perl.
In Activestate 629, the following:
use strict;
my %a = ();
push @{$a{"x"}}, "abcdef";
my @a1 = @{$a{"x"}};
my $a1_size = scalar @a1;
print "a1_size: $a1_size\n";
print "a1[0]: $a1[0]\n";
gives:
C:\TEMP>t1.pl
a1_size: 1
a1[0]: abcdef
So apparently if the hash element does not exist, and you push on it, it
is automatically made into an array reference.
> -----Original Message-----
> From: Jeffrey [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, January 24, 2002 4:53 PM
> To: Perl win32
> Subject: RE: Strange assignment
>
>
> Doh! I hate it when I post to the list, then find the
> answer when I go back to the code.
>
> The next line is:
> push(@{$hash{$symbol}}, $value);
>
> So obviously setting $hash{$symbol} to [] makes it an
> anonymous array.
>
>
> =====
> ------------------------------------
> Jeffrey Hottle
> nkuvu at yahoo dot com
>
> __________________________________________________
> Do You Yahoo!?
> Great stuff seeking new owners in Yahoo! Auctions!
> http://auctions.yahoo.com
> _______________________________________________
> Perl-Win32-Users mailing list
> [EMAIL PROTECTED]
> http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users
>
_______________________________________________
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users