Randal L. Schwartz wrote: >>>>>> "Scott" == Scott R Godin <[EMAIL PROTECTED]> writes: > >>> my %hash = map {/\w+/g} <DATA> >>> >>> :-) > > Scott> grin away. This shortcut deserves to be in the perldocs > Scott> somewhere. I wish I'd seen this before. > > The problem is that it is very intolerant of mis-formatted data. If I > had a line that had one or three items, or an item that was a hostname > that had a hyphen in the name for example, then that line and all > subsequent lines would be misinterpreted. > > Probably better is: > > my %hash = map /^(\w+),(\w+)\n/, <DATA>; > > which ensures that faulty data merely messes up that particular entry, > not all entries. And it serves to document the result better, I > think. >
very very true. brevity isn't always the master of wit. :) -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]