Outputsuse strict; use warnings; my $lines = 0; my $mystring = ''; my $chars = 0; my $word_cnt = 0; while(<DATA>) { 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.
Lines: 4 Words: 36 Characters: 180 Total String: thequickbrownfoxjumpsoverthelazydogthequickbrownfoxjumps +overthelazydogthequickbrownfoxjumpsoverthelazydogthequickbrownfoxjump +soverthelazydog
In reply to Re: Removing characters
by olus
in thread SOLVED Removing characters
by Slug
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |