Re: map() definition help

2002-05-03 Thread John W. Krahn
Scott Lutz wrote: > > What is the purpose of the following code? > > @list = keys %{{map{$_,1} @list}}; This removes any duplicate elements in @list. $ perl -le' @list = qw[a b c d e d c b d]; print "@list"; @list = keys %{{map{$_,1} @list}}; print "@list"; ' a b c d e

Re: map() definition help

2002-05-03 Thread Sudarsan Raghavan
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