in reply to word count
Maybe you'll like this better than wc:
#!/usr/bin/perl use strict; use warnings; my $count = 0; while (<DATA>){ $count++ while m/[a-zA-Z]\w*/g; } print $count, $/; __DATA__ Usage: perl [switches] [--] [programfile] [arguments] -0[octal] specify record separator (\0, if no argument) -a autosplit mode with -n or -p (splits $_ into @F) -C[number/list] enables the listed Unicode features -c check syntax only (runs BEGIN and CHECK blocks) -d[:debugger] run program under debugger
This searches for words beginning with a latin letter. If you want to match word characters belonging to other languages, consider the regex m/\pL\w*/g instead.
|
|---|