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

Use map to transform one list of values into a new list; use for to iterate over a list performing some operations. In both of your cases you're not really generating a new list. The first one could be done as  my %byFile = map { chomp; split( /\s+/, $_, 2 ) } <DATA>, but I'd personally use the for instead. Considering your second loop is a single statement I'd probably write it as print "$_\t=>$byFile{$_}\n" for keys %byFile, but definately not using map.