Re: about map usage

2006-09-13 Thread Igor Sutton
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

Re: about map usage

2006-09-13 Thread jeffhua
L PROTECTED] To: beginners@perl.org Sent: Wed, 13 Sep 2006 9:38 PM Subject: about map usage Hi all, In perlfaq4.pod I see one line: my %hash = map { $_, 1 } @array; What is the usage of 1 in this code? Thanks, Li __ Do You Yahoo!? Tired of spa

Re: about map usage

2006-09-13 Thread Rob Coops
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]>

about map usage

2006-09-13 Thread chen li
Hi all, In perlfaq4.pod I see one line: my %hash = map { $_, 1 } @array; What is the usage of 1 in this code? Thanks, Li __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com -- To unsub