Phoenix.pm: map + grep problem
Scott Walters
scott at illogics.org
Tue May 6 11:30:32 CDT 2003
In the documentation, something like
@foo{...} instead of $foo{...} or
%foo{...} instead of %foo{...}
... is called a "slice".. either an "array slice" or "hash slice". It gives you
a list context to assign to or from.
This is used most commonly when asking for several elements of an array:
my($time, $date, $name) = @record[3,6,7];
rather than:
$time = $record[3]; $date = $record[6]; $name = $record[7];
Glad to see some discussion in here =)
-scott
On 0, 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
>
>
>
More information about the Phoenix-pm
mailing list