It's glob and/or bsd_glob from the underlying C stdlib. Another interesting example of things the stdlib glob can do:
#!/usr/bin/perl
# perl since it's an easy way to use an arbitrary function from stdlib
use File::Glob "bsd_glob";
for (bsd_glob("{Hello,Hi} {world,everyone}...a {demo,example}")) {
print($_."\n");
}