use matcher in next_perm