Rob Dixon wrote:

> John W. Krahn wrote:
>> David Gilden wrote:
>> >
>> > OK, one problem is solved, which was the path to the data file.
>> > I know there is a simple way to read in a file like the following:
>> >
>> > apple,2
>> > banana,4
>> > kiwi,1
>> >
>> > and produce a HASH. The code below works I get the feeling there is
>> > a more compact way to accomplish this.
>>
>> Yes, there is.  :-)
>>
>> my %hash = do { local $/; <FH> =~ /[^\n,]+/g };
> 
>     my %hash = map {/\w+/g} <DATA>
> 
> :-)

grin away. This shortcut deserves to be in the perldocs somewhere. I wish 
I'd seen this before. 

...and I thought I was impressed by the earlier post. *shaking head* 
sheeeeeesh. I should know better by now. :D

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to