in reply to I don't get map. How would I use map here?

Personally, I wouldn't use map in either of those places. Definitely not in the second, since it would be evaluating it for side effects only. For the first you could use
%byFile = map {(split /\s+/)[1,0]} <DATA>;
with the proviso that it would remove anything already in %byFile. That is, it would take each element from DATA and translate it into two elements, creating a list of pairs to be treated as a hash. But I still don't think this is a great place for map, because it's not as easy to read (and quite a bit more confusing).