> 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/w/walk-a-directory/non-recursively.md).

# Non-recursively

The `dir` function takes the directory to traverse, and optionally a named parameter `test`, which is [smart-matched](https://docs.raku.org/routine/$TILDE$TILDE) against the basename of each file (so for example we can use a regex):

```perl
.say for dir ".", :test(/foo/);
```
