You are slurping in the file in one go, due to your setting
of
$/ to undef. That means
<F> is
going to return a single string, the content of the entire
file. Which means that if the file contains a C or C++
style comment, or a single or double quoted string, that
single string is passed to
map. The map makes a
two element list out of this, the first element the line
number of the last "line" of the file - it this case 1, as
there is only one line. So, you get a one-key hash, with
key 1, and value the entire content of the file.
The problem you are working on is a bit more complicated
than what you can do in a simple regexp.
Abigail