Scott Lutz wrote:

> What is the purpose of the following code?
>
> @list = keys %{{map{$_,1} @list}};

map {$_, 1} @list ----> $_ is holds the value of the current element of @list
i.e. being processed
for e.g. if @list contains ("abc", "def", "ghi"), a list like ("abc", 1, "def",
1, "ghi", 1) is the output
This list being treated as a hash (the %). The keys returns the keys of the
hash i.e. "abc", "def", "ghi",
except since the keys of the hash need not stored in the same order in which
they are formed, the
resulting @list contains a shuffled form of the original @list.

you can also take a look at perldoc -q shuffle

>
>
> I am looking over someone else's code, and I am not familiar with the map()
> function.
> I have looked through the perl docs on www.perldoc.com, but it doesn't quite
> get this deep.
>
> Any help would be great.
>
> --
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to