my %hash = map { $_, 1 } @array;
What is the usage of 1 in this code?
When you have any kind of doubt about a Perl structure, you can use
Data::Dumper:
use Data::Dumper;
my %hash = map { $_, 1 } @array;
print Dumper \%hash;
Try it!
--
Igor Sutton Lopes
t: +55 51 9627.0779
e: [EMAIL PROTE
Hello,
I'd like to give you a good article for the wonderful introduce for perl's
map,sort and grep.See here:
http://web.archive.org/web/20041123005900/http://www.raycosoft.com/rayco/support/perl_tutor.html
Hope it's useful.
-jeff
-Original Message-
From: [EMAIL PROTECTED]
To: begi
What this does is creating a hash that looks like this:
%hash {
$array[0] => 1,
$array[1] => 1,
$array[2] => 1,
$array[3] => 1,
ect.
}
It is a (posibly the quickest way) of changing a array into a hash.
Hope it helps.
On 9/13/06, chen li <[EMAIL PROTECTED]>