A few more things:
- First off, after you use strict; like dragonchild recommended, you will notice that @WordList isn't scoped properly. Also, while you have the right idea towards good, modular code by using functions, your functions need to be... functionized. The first one, actsin1, doesn't even really need to be a function at all. In fact, if it wasn't a function, you would no longer have any scoping problems associated with @WordList. Your The second one, Group, should accept the array as an argument. Keeping a tight scope is a good programming practice.
- $ListPos +=1 should be $ListPos++. Its much more readable this way - the ++ operator is there for a reason, you know :)
- In your file paths, just use a single forward slash - perl will translate the slashes to the correct type based on the system.
- This block:
if ($TheLine =~ /<RD>[^\n]*Status Compendium<<.JL>/i)
{
$ListPos = 0;
until($ListPos > $#WordList)
{
if ($TheLine eq $WordList[$ListPos])
{
$TheLine = "";
pop(@WordList)
}
$ListPos +=1
}
}
print OUTPUT "$TheLine";
can be reduced to:
if ($TheLine =~ /<RD>[^\n]*Status Compendium<<.JL>/i)
{
for(my $i=0; $i > @WordList; $i++)
{
print OUTPUT $TheLine if ($TheLine ne $WordList[$i])
}
}
This is much more easy to read and efficient, since you arent using @WordList after you are done with the program. Give it a whirl.
- Instead of explictly timing your program, consider using Benchmark. It is much more accurate
Sorry for being nitpicky, but I felt the urge :) Good Luck!