in reply to Re: preventing malicious mail attacks
in thread preventing malicious mail attacks

Okay, I'll try your code in a minute..it seems like I have more than just that problem. I can't find a way to delete that key!

The key is:

xung03@aol.com To: xung03@aol.com From: xung03@aol.com Subject: Hog(DA +913529,email) JmW yB Q eoP .
I tried:
delete $emails{"xung03\@aol\.com To\: xung03\@aol\.com From\: xung03\@ +aol\.com Subject\: Hog\(DA913529\,email\) JmW yB Q eoP \."};
And:
delete $emails{"xung03@aol.com To: xung03@aol.com From: xung03@aol.com + Subject: Hog(DA913529,email) JmW yB Q eoP ."};
But the silly infected hash key/value won't leave lil' me alone :(

Replies are listed 'Best First'.
Re: Re: Re: preventing malicious mail attacks
by CountZero (Bishop) on Feb 01, 2004 at 19:24 UTC
    You don't have to escape "funny" characters in a hash key.

    Are you sure the key is correct? No trailing spaces or so? What error message do you get when you try to delete this key (in other words how do you know the key was not deleted)?

    CountZero

    "If you have four groups working on a compiler, you'll get a 4-pass compiler." - Conway's Law

      I'm using:
      delete $emails{'xung03@aol.com To: xung03@aol.com From: xung03@aol.com + Subject: Yq(DA913529,name)RiatdJ VoyY41ILqAdOjfxkvfKaH8JMobcYw .'}; foreach (keys %emails) { print "$_ => $emails{$_}<br>"; }
      I'm printing all the keys/values AFTER I try to delete it, but that key just doesn't go away. as you can see through my print, the => is my separator between the hash key and it's value. That means that everything before the => is the key and that's what I'm trying to get rid of.
        Try this:

        foreach (keys %emails) { delete $emails{$_} if /xung03\@aol.com/; }

        It is an ugly hack and use it only if there are no other keys which contain xung03@aol.com

        CountZero

        "If you have four groups working on a compiler, you'll get a 4-pass compiler." - Conway's Law