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 [EMAIL PROTECTED] and [EMAIL PROTECTED]
> 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 /(.+)[EMAIL PROTECTED]/, $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

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to