chomp(@exeDllLines); my @dllarray; foreach (@exeDllLines) { push @dllarray, $_ if /\.(?:dll|exe)$/i; }