Perl Script only displaying first line of text file -


when run script, outputs first line of text file.

it supposed take list of email addresses , output ten occurring domains.

for example, timmy@yahoo.co.uk => 4 joebloggs@hotmail.com => 3

 #!d:\perl\bin\perl      #read file     open f, "<emails.txt" or die $!;     while (<f>) {         print $_;     {      close f;      perl ne        $s{$_}++      }{        print map "$s{$_}: $_",        (sort {$s{$b} <=> $s{$a}} keys %s)[0..9] }} 

doesn't this:

while (<f>) {     print $_; {  close f; 

close filehandle within while() loop i.e. after first line ? suspect need like:

while(<f>) {    # } close(f); 

Comments

Popular posts from this blog

assembly - 8086 TASM: Illegal Indexing Mode -

Java, LWJGL, OpenGL 1.1, decoding BufferedImage to Bytebuffer and binding to OpenGL across classes -

javascript - addthis share facebook and google+ url -