Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW

RE: Re: charachter classes

by mdillon (Priest)
on Aug 21, 2000 at 03:43 UTC ( [id://28750] : note . print w/replies, xml ) Need Help??

in reply to Re: charachter classes
in thread charachter classes, and a misunderstanding...

in my dictionary file, there are multiple left-hand-only words sharing the longest length. the following code outputs all of them.

@ARGV = qw(/usr/dict/words); my $len = 0; my @largest; while (<>) { chomp; next unless length >= $len && /^[qazwsxedcrfvtgb]+$/i; if (length > $len) { @largest = (); $len = length; } push @largest, $_; } print join(', ', @largest), $/;

this gives the full set of answers: 'aftereffect', 'desegregate', 'exacerbated', 'exacerbates', 'exaggerated', 'exaggerates', 'reverberate', and 'vertebrates'.