my @matches = grep { /$pattern/ } @names;