Hello
I am writing a script that will look through e-mail headers and input
information into a database bases on some rules. I am using the Message-ID field in
the mail header as input for some of the fields and am having problems with pattern
matching since some of the characters in the Message-ID header are the dollar sign ($).
Specifically, I am having some problems on a sub routine that will search
through a list of message IDs and remove the one that matches what is passed to the
routine. Below is the subroutine in question. I have some trouble-shooting lines at
the bottom, normally it would do the splice and return. @mess_order is the array of
the message IDs defined earlier in the script.
sub killit {
my $remove = shift;
my $pos = ();
for (my $i = 0; $i < @mess_order; ++$i) {
if ($mess_order[$i] =~ /^$remove$/i) {
$pos = $i;
}
}
my $foo = splice (@mess_order, $pos, 1,);
print "Child: \"$remove\"\n";
print "Foo: \"$foo\"\n";
print "i: \"$pos\"\n";
print "\n";
}
Below is a snipper of the output from the program showing a success and then a
failure (with only the domain names altered for privacy). Note that Foo: is what was
spliced out of the array. From the output, it looks as though perl is not able to find
a match, so $i does not get assigned a value, and therefore splice takes the first
thing off the array stack. There are about eighty e-mails that I am testing with, and
all the ones that have the problem are ones with a $ in the Message-ID, so that leads
me to believe that Perl is interpreting the $ as a variable in the =~ comparrison. I
am not 100% sure about this since I am using strict, and I would think strict would
produce an error for that.
Child: "[EMAIL PROTECTED]"
Foo: "[EMAIL PROTECTED]"
i: "1"
Child: "016b01c15bff$a8fc0000$7b0158c6@xp"
Foo: "501562527.1003864001247.JavaMail.foo@foo"
i: ""
If there is a better list to send this to, then please let me know. I could
not find an appropriate one on http://lists.cpan.org/, so please clue me in.
=-= Robert Thompson
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]