Phoenix.pm: map + grep problem

Shay Harding kellewic at yahoo.com
Mon May 5 23:18:19 CDT 2003


Hash slice. Perl flattens @a2 and the @h_a2 says to
take those and make them keys. If you wanted to assign
some other value to all the keys, you could do:

@h_a2{@a2} = ("value")x at a2;



Shay



--- Victor Odhner <vodhner at cox.net> wrote:
> Shay Harding wrote:
> > This could be written as:
> > my %h_a2;
> > @h_a2{@a2} = undef;
> 
> OK, wow.  It works nicely, but
> what on earth is @h_a2{@a2}???
> 
> I see you taking a hash, calling it a
> list, subscripting it like a hash,
> and using a list as the subscript.
> 
> I have no problem with subscripting a
> hash with a list, that's old hat.
> But what is it called when you put
> "@" in front of it instead of "$"?
> 
> I guess I should be asking for the
> latest and greatest in *Perl* books!
> I've been Perling continuously since
> 1994 but you guys are shaming me.
> 
> Vic
> 
> 
> 


__________________________________
Do you Yahoo!?
The New Yahoo! Search - Faster. Easier. Bingo.
http://search.yahoo.com



More information about the Phoenix-pm mailing list