in reply to Perl at Rosetta Code, with one particular example

I read the problem as replacing one or more e's, not all e's.

That gets these additions:

becker -> bicker complement -> compliment complementary -> complimentary empress -> impress endorse -> indorse enfield -> infield enquire -> inquire enviable -> inviable freedman -> friedman freeze -> frieze kenney -> kinney kettle -> kittle meddle -> middle peddle -> piddle redden -> ridden semper -> simper whether -> whither
FWIW, my first pass at this was
perl -E'chomp(my @w=grep /[ie]/ && length > 5, readline); for my $w (r +everse @w) { say "$w -> $_" for grep defined, @w{glob $w =~ s/e/{e,i +}/r}; $w{$w}=$w }' unixdict.txt

Replies are listed 'Best First'.
Re^2: Perl at Rosetta Code, with one particular example
by Anonymous Monk on Jun 13, 2025 at 12:23 UTC

    There are a few more with (missing) "g" modifier; and s/5/6/; anyway it gets above 1 s for me. OTOH (definitely not a one-liner though):

    # Rate am_new # am_new 40.9/s -- am_new => sub { my ( @a, %h ); open my $fh, '<:raw', 'unixdict.txt' or die; while ( <$fh> ) { next unless length > 6; chomp; push @a, $_ if -1 != index $_, 'e'; next unless -1 != index $_, 'i'; my $key = tr/e/i/r; $h{ $key } = $_ unless exists $h{ $key } and $_ lt $h{ $key } } close $fh; my ( @ret, $key ); exists $h{ $key = tr/e/i/r } and $h{ $key } gt $_ and push @ret, sprintf "%30s %s\n", $_, $h{ $key } for @a; @ret },

    And, e.g. for (some or all of) "e => a" (not "i") then "gt", "lt" should be swapped.

      Oops, yes, missing g. But did they change the problem? I see "The length of any word shown should have a length > 5."

      $h{ $key = tr/e/i/r } is wrong since $_ not set there. Perhaps the = should be a =~?

      (Nevermind)