#!/usr/bin/perl use Digest::SHA1; open EMAILLIST, "/home/crschmidt/foaf/sorted" or die; my @lines = ; close EMAILLIST; %hash; foreach (@lines) { m/(.) (.*?) ([a-f0-9]+) $/; $hash{$3} = $1. ":" .$2; # print "Init $3: $1:$2\n"; } #die; while() { if (m/^From: /) { if (m/<(.*?)>/ || m/From: (.*?) \(.*\)/) { print "has a name. email is $1, "; $ctx = Digest::SHA1->new; $ctx->add("mailto:".$1); $sha1 = $ctx->hexdigest; print "hex: $sha1"; if ($hash{$sha1}) { print " Level: " . $hash{$sha1}; } print "\n"; } else { print"no name:"; s/From: //; chomp; print; $ctx = Digest::SHA1->new; $ctx->add("mailto".$_); print ", hex: " . $ctx->hexdigest; print " Level: " . $hash{$ctx->hexdigest}; print "\n"; } } }