in reply to combining elements of arrays
Much of the type of logic that you're looking for is found in the log reduction program 'LogWatch' (although, some of that code is particularly bad... don't try to turn on 'use strict' or 'use warnings' without a whole lot of free time).
Anyway, the error you mention:
s/$1/ /g if ($line =~ m/^\w.*(\s\s).*/);
Is because that if you use s/// without specifying what it's acting on, it acts on $_. I'm guessing you wanted it to use $line :
$line =~ s/$1/ /g if ($line =~ m/^\w.*(\s\s).*/);
|
|---|