
use strict;

open(INFILE, $ARGV[0]);

my($WordCount) = 0;
my(%Words);
my($StartTime) = time();
while (<INFILE>)
{
	$_ = lc($_);
	foreach my $Word (split(/[\s\,\.\?\!'""\(\)\;\:]+/))
	{
		$WordCount++;
		$Words{$Word}++;
	}
}
close(INFILE);
my($DeltaTime) = time() - $StartTime;

foreach my $Word (sort(keys(%Words)))
{
	#print "$Word\t$Words{$Word}\n";
}

print "\nObliczono $WordCount w $DeltaTime sekund\n";