Re: I don't know where to start with this one.
- From: krahnj@xxxxxxxxx (John W. Krahn)
- Date: Tue, 30 Jan 2007 15:45:53 -0800
Kenton Brede wrote:
This is getting very close to what I'm trying to do, see below. There
is just one point I'm stuck on, how to grab the username portion of
the email address into a variable. I'm able to get the username of
the official email address @mail.nowhere.com, but I can't seem to
figure out how to grab each username of the aliases @nowhere.com.
What I've written below seems to grab a "slice" or something and isn't
a true array value. What I would like is to grab j_johnson and
jim_johnson from j_johnson@xxxxxxxxxxx and jim_johnson@xxxxxxxxxxxx
So I could use each username as a variable for a different portion of
the email.
[ snip ]
for my $email ( keys %emails ) {
@names = @{$emails{$email}};
print "These are your mismatched email names: ";
for my $line ( @names ) {
my @n = ($line =~ /(.*)@/);
my @netid = split(/@/, $email);
print "$n[0], $netid[0]";
}
local $" = ', ';
my $message = <<TEXT;
These are your email aliases: @{$emails{$email}}
This is your official email address: $email
TEXT
print $message;
}
for my $email ( keys %emails ) {
local $" = ', ';
my @names = map /(.+)\@.*nowhere\.com\z/, $email, @{ $emails{ $email } };
print <<TEXT;
These are your mismatched email names: @names
These are your email aliases: @{$emails{$email}}
This is your official email address: $email
TEXT
}
John
--
Perl isn't a toolbox, but a small machine shop where you can special-order
certain sorts of tools at low cost and in short order. -- Larry Wall
.
- References:
- I don't know where to start with this one.
- From: "Kenton Brede"
- Re: I don't know where to start with this one.
- From: John W. Krahn
- Re: I don't know where to start with this one.
- From: Kenton Brede
- I don't know where to start with this one.
- Prev by Date: Re: confusion with splitting columns using [-n, -n] (e.g; my ( $country, $bytes ) = ( split )[ -2, -1 ])
- Next by Date: Calculate date
- Previous by thread: Re: I don't know where to start with this one.
- Next by thread: Re: I don't know where to start with this one.
- Index(es):
Relevant Pages
|