Help for this page

Select Code to Download


  1. or download this
    Usage: perl [switches] [--] [programfile] [arguments]
      -0[octal]       specify record separator (\0, if no argument)
    ...
      -C[number/list] enables the listed Unicode features
      -c              check syntax only (runs BEGIN and CHECK blocks)
      -d[:debugger]   run program under debugger
    
  2. or download this
    #!/usr/bin/perl -n
    s/[^\w]+/ /g;     # replace the non words with space
    next if(/^\s*$/); # discard sentence with only spaces
    $totalcount += (split(/ /) - 1); # split the sentence using space and 
    +count it
    END{ print "Total: $totalcount<<\n"; }