Existence of a certain continuous function for every closed set implies perfect normality. What I'm trying to show is that a topological space $(X,\mathcal T)$ is perfectly normal if there exists, for every closed set $C\subseteq X$, a continuous function $f:X\rightarrow [0,1]$ such that $C=f^{-1}(0)$.
If I fix disjoint, non-empty closed sets $C,D\subseteq X$, I can find functions $f,g:X\rightarrow [0,1]$ that satisfy the aforementioned condition for each closed set, respectively. I can define a new function $h(x)=1-g(x)$, so that I now have a continuous function such that $D=h^{-1}(1)$. The issue is putting these functions together using the pasting lemma. 
How can I do this? Should I consider an alternative to $h(x)$? 

Having continuous $f: X \to [0,1]$ with $f^{-1}[\{0\}]=C$ and continuous $g:X \to [0,1]$ with $g^{-1}[\{0\}]=D$ we define $h: X \to [0,1]$ by $h(x)=\frac{f(x)}{f(x) + g(x)}$.
The denominator is never $0$ as that would require $f(x)=g(x)=0$ or $ x\in C \cap D  =\emptyset$.  So $h$ is well defined and as $0 \le f(x) \le f(x)+g(x)$ for all $x$, $h(x) \in [0,1]$. And $h$ is continuous whenever $f$ and $g$ are. Also 
$$h(x)=0 \iff f(x)=0 \iff x \in C$$ and
$$h(x)=1 \iff f(x)=f(x)+g(x) \iff g(x)=0 \iff x \in D$$
So $h$ separates $C$ and $D$ exactly.
