On Sun, 5 Jun 2005 12:05:08 -0700, you wrote:

>At 07:05 PM 6/4/05 -0700, $Bill Luebkert wrote:
>>One more using the hash slice suggestion:
>>
>>my %hash2;
>>@hash2{grep /$something/, @array} = (1) x @array;
>
>I wasn't aware that u could take a slice of a hash.  Interesting.  I had to
>try it out to see if it actually worked and I came up with another little
>benefit of doing it.  You can keep track of the insert order into the hash
>and the match from the grep array.

If tracking the insert order is really important, it would probably be
better to take advantage of the Tie::IxHash module, which is available
on CPAN and many PPM repositories, including ActiveState's. It has a
number of handy features, and you can treat the hash almost like an
ordinary array. The documentation explains it quite well.

-- 
Eric Amick
Columbia, MD

_______________________________________________
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to