use strict; use warnings; my $lines = 0; my $mystring = ''; my $chars = 0; my $word_cnt = 0; while() { my $str = $_; $chars += length($str); $lines++ ; my @words = grep /\w/, ($str =~ /\b\w*\b/g); $word_cnt += $#words + 1; $str =~ s/( |,|\.|\n|\t)//g; $mystring .= lc($str); } print "Lines: $lines\n"; print "Words: $word_cnt\n"; print "Characters: $chars\n"; print "Total String: $mystring\n"; __DATA__ The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog.