>>>>> "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.
--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<[EMAIL PROTECTED]> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]