in reply to Re^2: regex help please
in thread regex help please

Your problem appears to be that
while (<SPAMMESSEGES>) {
Assigns one line to $_ and then
my $spam = <SPAMMESSEGES>;
Assigns the next line to $spam so you are only processing every second line.