in reply to Re: Accumulating data in a hash using map{split()}
in thread Accumulating data in a hash using map{split()}

Actually I'd consider Merlyn's variant even more magical, but an idiom well worth knowing.

There is a tension here between "succinct" and "lucid" with the two line version being at the lucid end of the spectrum and either of the one line solutions being toward the succinct end.

You may find:

%hash = (%hash, split /:/, <DATA>, 2);

a little less magical than the variant using map btw in a context where you are dealing with single lines.


DWIM is Perl's answer to Gödel