in reply to Combining Files using Hash

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+\ +d+.\d+.)/g; my($key,$value1,$value2,$value3,$value4,$value5,$value6,$value7) = $li +ne =~ /(\w+|\S+),(\d+),(\d+),(\d+),(\d+.\d+),(\d+.\d+),(\d+),(\d+.\d+ +)/g ;

to make them look like the following:

my($key,$value1,$value2,$value3) = ($line =~ /(\w+),(\d+.\d+),(.\d+\s+ +\d+.\d+.)/g); my($key,$value1,$value2,$value3,$value4,$value5,$value6,$value7) = ($l +ine =~ /(\w+|\S+),(\d+),(\d+),(\d+),(\d+.\d+),(\d+.\d+),(\d+),(\d+.\d ++)/g);

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.