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 };
Holy Handgrenades, Batman!
but where's the implicit split of key and value there? forgive me for
asking, but I just don't see it. is there some magic going on here?
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]