chomp(@exeDllLines); my @dllarray; push @dllarray, grep { /\.exe$/i } @exeDllLines; push @dllarray, map { "[$_]"} grep { /\.dll$/i } @exeDllLines;