create 3 arrays. first array last names, second name first name and third array has asked for the wisdom of the Perl Monks concerning the following question:

the piece of code i'm working on now uses Net::POP3 I use $message=$pop->get($msg_num) to grab the message (including headers) then $message can be printed entirely using print @$message inside a foreach loop. I want to exclude headers, so i'm using an array with values like "Reply-To", etc. which is why I need to print a string but only if it doesn't match a value in an array.
  • Comment on I need to print a string but only if it doesn't match a value in an array.

Replies are listed 'Best First'.
Re: I need to print a string but only if it doesn't match a value in an array.
by japhy (Canon) on Feb 22, 2001 at 01:41 UTC
    You don't want to use an array here, I bet. You want to use a hash. See the FAQ entry for "contains". perldoc -q contains
Re: I need to print a string but only if it doesn't match a value in an array.
by TheoPetersen (Priest) on Feb 22, 2001 at 01:58 UTC
    Why not use Mail::POP3Client instead? It has methods to get the headers, body or both of a given message.
    $message=$pop->Body($msg_num);
Re: I need to print a string but only if it doesn't match a value in an array.
by create 3 arrays. first array last names, second name first name and third array (Initiate) on Feb 22, 2001 at 02:03 UTC
    I origionally went with Mail::POP3Client but found Net::POP3 more straightforward
      I faced a similar choice with IMAP modules, and went with Net::IMAP because it had the method I needed specifically for a simple biffer. In your case, if Mail::POP3Client has a method that gets rid of a lot of your own code, it seems worth using.

      In your topic post you said you wanted to delete headers, but your approach seems error prone at best (what if you encounter a header you didn't plan on). The Body method of Mail::POP3Client works because it uses the structure of a message, not a list of known headers.

      How about giving Mail::POP3Client another go? You can post more questions or /msg me if you need help with specifics.

        yeah I actually gave it another try last night, cut my code in half, I figured that the problem I was having was that my mail server uses plaintext instead of apop, and so it kept failing. thanx for all the help my next hurdle is DBI and MySQL, wish me luck :)