I can't find anywhere in your script where this is being called, therefore it wouldn't do anything.
# Subject check
my($msgSubject);
my($hfile) = "HEADERS";
while(<HEADERS>) {
chomp;
$line = $_;
$idx = index($line, "Subject: ");
if (idx == 0){
$msgSubject = substr($line, 9);
}
}
You are assigning the value "HEADERS" to $hfile, so:
print $hfile;
would print HEADERS.
If you are trying to read the value of a file, I would suggest passing it as an array, and doing:
foreach $line (@file) {
instead of
while(<HEADERS>) {
Either that or open the file in the function:
open(HEADERS,"filename.txt");
while(<HEADERS>) {
Or pass the file handle to the function:
filter_begin("subject", *HEADERS);
sub filter_begin {
my ($blah, $handle) = @_;
while(<$handle>) {
Sorry if this isn't very clear I haven't been awake long.
HTH
Ben