Looking at the code below, can anyone help me figure out how to compare the
e-mail addresses in @addresses with the e-mail addresses in @emails and
print out to the new file as shown, but minus the matching addresses?

Scot R.
inSite


#!/usr/bin/perl -w

use CGI;
use CGI::Carp qw(fatalsToBrowser);

$q = new CGI;

$datafile  = '/usr/apache/htdocs/path/to/.tracker';
$datafile2 = '/usr/apache/htdocs/path/to/.tracker2';
$company = $q->param('customercomp'); # scalar comes from form param
@addresses = $q->param('customeremail'); # list comes from form param

$/ = '*'; # split file records on '*'

print $q->header;

open(FILE,"<$datafile") or die "Couldn\'t open data file.";
@records = <FILE>;
close(FILE);

open(FILE2,">$datafile2") or die "Couldn\'t open data file 2.";

foreach $record(sort(@records)) {
 chomp($record);
 ($comp,$addr) = split(/\|/, $record);
  @emails = split /:/, $addr;

# Right here, I want to see if any of the addresses
# in @addresses match an address in @emails for this
# particular $record.

# Now, if $comp eq $company, I want to print join ':'
# the e-mail addresses MINUS any $address[$_] that
# matched $emails[$_].

  print FILE2 "$comp\|";
  print FILE2 join(':', @emails); # minus any matching $address[$_]
  print FILE2 $/;
}

close(FILE2);




-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to