>>>>> "JP" == Jeff Pinyan <jeffp@crusoe.net> writes: JP> Submissions I incorporate will be acknowledged. damn right you will, you young whippersnapper! when i was your age i had to program by punching out tiny holes in pieces of cardboard. you kids are spoiled rotten with your pentiums and win2k super whiz systems! JP> array-to-hash JP> while (($k,$v) = each %{{ @list }}){ ... } slow as you have to build a hash just to get pairs. might as well copy to a temp array and eat it with splice. JP> while ($i < @list){ ($k,$v) = @list[$i++,$i++]; ... } the order and values if $i may surprise you. i have seen weird results in perl with multiple side effect. better do that as ($k,$v) = @list[$i, $i + 1] ; $i +=2 ; } JP> slicing JP> @list = (somefunc())[1,4,6..9]; s/func/expression/; JP> hash things JP> @uniq{@list} = (); good one to know JP> keys %{{ @tmp{@list} = () or %tmp }}; why do that when you either get the keys (which came from @list) or the number of keys (also found in @list) depending on context? it looks cuter than its functionality. JP> I'd like some more ideas for idioms. Some of them might be ones JP> no one else has seen (I doubt anyone has used that last idiom I JP> put up there). There are many commonly known ones that I've not JP> put up on this list, but mention them as well, just in case. check out my hash slice tutorial. i have posted it to misc twice over the last year or so. if you can't find it i will send it to you. it has lots of idiomatic uses and examples of hash slices. one day i want to expand that into a much longer article on hashes. i have several section titles: an associative array by any other name from hashes to hashes nothing's better than sliced hash i have to much on my plate to even think about this. but i shall keep dreaming. uri -- Uri Guttman ----------------- SYStems ARCHitecture and Software Engineering uri@sysarch.com --------------------------- Perl, Internet, UNIX Consulting Have Perl, Will Travel ----------------------------- http://www.sysarch.com The Best Search Engine on the Net ------------- http://www.northernlight.com "F**king Windows 98", said the general in South Park before shooting Bill. ==== Want to unsubscribe from Fun With Perl? Well, if you insist... ==== Send email to <fwp-request@technofile.org> with message _body_ ==== unsubscribe