#!/usr/bin/perl

#test3.pl -- snipet
#foreach with hash -- often used examples...
#the one shown in the class is snip of this code.
#use strict;

open( USERNAMES, "<test2txt") || die "can't open test2txt $! \n" ;
while( $sometext = <USERNAMES> ){
	$name = getnextemail($sometext);
	#What does this do?
	if ($emailcount{$name})  {
		$emailcount{$name}++;
	}else{
		$emailcount{$name} = 1;
	}
}
foreach $k (keys %emailcount) {
	print "$k = ";
	print $emailcount{$k};
	print "\n";
}

sub getnextemail {
	my $line = @_[0];
	chomp($line);
	return $line;
}
