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>

:-)

Rob






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

Reply via email to