in reply to Sorting words, keeping only certain words
No attempt a golf, but clear I think.
#! perl -sw use strict; while (<DATA>) { chomp; print sprintf('%-20s', $_), (/^[a-z][a-z-]+?[a-z]$/i and not /--/) ? ' is ' : ' is not ', 'a valid word according to the rules specified.', $/; } __DATA__ brian0 brian- -brian bri--an Bria-n br-i-an brian
P.S. There's no need to put the whole question in the title:)
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Sorting words, keeping only words that start with a letter and contain only letter characters, and hypens, and end in a letter
by tachyon (Chancellor) on Nov 10, 2002 at 23:06 UTC |