J
Jim Weeb
Can anyone offer some help with perl and a script operating a
mail2news gateway?
I'm using CPAN module email:simple so, I can get the groups into
variables using:
$newsgroups=$mail->header("Newsgroups");
$followupto=$mail->header("Followup-To");
Now, when processing the message, I only want to allow
followupto groups that are present in newsgroups - not any
alternative group(s). Group(s) in followupto may be listed in a
different order to those in the original newsgroups line.
I guess I need to combine the groups in each variable into an
array:
@newsgroups2 = split /,/ , $newsgroups ;
@followupto2 = split /,/ , $followupto ;
and then somehow see which items are in both arrays and write
those that are to a new variable $followupto3 (or even back to
the original $followupto)
I guess it would be done with two nested loops, however someone
previously mentioned something about a hash with regard to a
similar problem (and lost me completely). It could probably all
be done in one or two lines by a perl boffin, but unfortunately
my perl, although improving slowly, isn't quite up to the task.
Thanks.
mail2news gateway?
I'm using CPAN module email:simple so, I can get the groups into
variables using:
$newsgroups=$mail->header("Newsgroups");
$followupto=$mail->header("Followup-To");
Now, when processing the message, I only want to allow
followupto groups that are present in newsgroups - not any
alternative group(s). Group(s) in followupto may be listed in a
different order to those in the original newsgroups line.
I guess I need to combine the groups in each variable into an
array:
@newsgroups2 = split /,/ , $newsgroups ;
@followupto2 = split /,/ , $followupto ;
and then somehow see which items are in both arrays and write
those that are to a new variable $followupto3 (or even back to
the original $followupto)
I guess it would be done with two nested loops, however someone
previously mentioned something about a hash with regard to a
similar problem (and lost me completely). It could probably all
be done in one or two lines by a perl boffin, but unfortunately
my perl, although improving slowly, isn't quite up to the task.
Thanks.