> For the complete documentation index, see [llms.txt](https://trizen.gitbook.io/perl6-rosettacode/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://trizen.gitbook.io/perl6-rosettacode/programming_tasks/s/semordnilap.md).

# Semordnilap

```perl
my $words = set slurp("unixdict.txt").lines;

my @sems = gather for $words.flat -> $word {
    my $drow = $word.key.flip;
    take $drow if $drow ∈ $words and $drow lt $word;
}

say $_ ~ ' ' ~ $_.flip for @sems.pick(5);
```

#### Output:

```
abut tuba
avid diva
bard drab
loot tool
part trap
```
