#!/usr/bin/env perl # words - list all words (a-zA-Z0-9 only) in the input, translated to lowercase # # $Id: words 771 2010-10-15 10:14:31Z rp $ # -x for extended filtering (i.e., fewer words) use warnings; use strict; use Getopt::Std; my %opt; getopts('ux', \%opt); $| = !!$opt{u}; # if -u, flush after every line my $rx = $opt{x} ? qr/[\W\d]/ : qr/\W/; while (<>) { chomp; map { length and print "\L$_\n" } split /$rx/; }