Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re: How to do script to separate name and email domain ?

by CountZero (Bishop)
on Sep 07, 2010 at 06:18 UTC ( [id://859117]=note: print w/replies, xml ) Need Help??


in reply to How to do script to separate name and email domain ?

More compact, but essentially the same as the previous ones:
use strict; use warnings; my %domains; $domains{(split /@/)[-1]}++ for <DATA>; print map "# $domains{$_} $_", sort keys %domains; __DATA__ jaja@email.com kaka@myemail.com baba@youremail.com lala@email.com
Output:
# 2 email.com # 1 myemail.com # 1 youremail.com

CountZero

A program should be light and agile, its subroutines connected like a string of pearls. The spirit and intent of the program should be retained throughout. There should be neither too little or too much, neither needless loops nor useless variables, neither lack of structure nor overwhelming rigidity." - The Tao of Programming, 4.1 - Geoffrey James

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://859117]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others musing on the Monastery: (4)
As of 2024-04-19 16:49 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found