my @files = $ftp->ls(); my @cat1 = grep { /h+_/ } @files; my @cat2 = grep { /-zips/ } @files;