in reply to Re: Sorting words, keeping only words that start with a letter and contain only letter characters, and hypens, and end in a letter
in thread Sorting words, keeping only certain words
This will fail on valid edge cases words like 'Oh no I no go OK' as your minimum valid word length is 3 chars. A small bit of modification will cover all cases:
my @data = sort grep { /^[a-z][a-z-]*[a-z]$/i && ! /--/ || /^[a-z]$/i +} <DATA>;
cheers
tachyon
s&&rsenoyhcatreve&&&s&n.+t&"$'$`$\"$\&"&ee&&y&srve&&d&&print
|
|---|