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

The key thing to understand is that map returns a list.

If you do not need a list returned, (which is the case in your example),use for.

Update:Style suggestion:
Your second loop is better written as

while (my ($k,$v) = each %byFile ) { print "$k\t=>$v\n"; }
This is more idiomatic, uses less memory, and is faster than your loop.

Offense, like beauty, is in the eye of the beholder, and a fantasy.
By guaranteeing freedom of expression, the First Amendment also guarantees offense.