I haven't tested your code or looked closely at your regexes. But here are a few thoughts.
I believe that the two lines where you are trying to parse a line from a file need to have the regex within parentheses. In other words, change these original lines:
my($key,$value1,$value2,$value3) = $line =~ /(\w+),(\d+.\d+),(.\d+\s+\
my($key,$value1,$value2,$value3,$value4,$value5,$value6,$value7) = $li
+ne =~ /(\w+|\S+),(\d+),(\d+),(\d+),(\d+.\d+),(\d+.\d+),(\d+),(\d+.\d+
to make them look like the following:
my($key,$value1,$value2,$value3) = ($line =~ /(\w+),(\d+.\d+),(.\d+\s+
my($key,$value1,$value2,$value3,$value4,$value5,$value6,$value7) = ($l
+ine =~ /(\w+|\S+),(\d+),(\d+),(\d+),(\d+.\d+),(\d+.\d+),(\d+),(\d+.\d
An easy debugging step is to print out the variables to verify that they are indeed holding what you think they are. Based on your description of the error message, it sounds like one of your regex lines isn't matching for all lines of the file (such as the header line or blank lines).
In looking at your data, it looks like the files are in CSV format. Although it might be tempting to use split to parse those lines, I think it probably would be better to use something like Text::CSV to parse those files.
Are you posting in the right place? Check out Where do I post X? to know for sure.
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
Want more info? How to link or
or How to display code and escape characters
are good places to start.