The ternary expansion of $x \in [0,1)$ is found by this construction: divide the interval into three equal parts, that is,
$$
[0,1) = [0,1/3) \cup [1/3 \cup 2/3) \cup [2/3 \cup 1).
$$
To find the ternary expansion of $x$, see in which of the three subintervals $x$ lies in. If $x \in [0,1/3)$, then the first digit in the expansion is $0$; if $x \in [1/3,2/3)$, then the first digit in the expansion is $1$; if $x \in [2/3,1)$, then the first digit in the expansion is $2$. To find the next digit, further divide the subinterval in which $x$ lies into three equal parts and repeat the same process.
By the way the Cantor set is contructed, the digit $1$ can never appear in a ternary expansion of $x \in C$ because the middle one-third is removed successively from each sub-interval. Of course, this is unless $x = 2/3$, in which case, its ternary expansion is $0.1$. However, $2/3$ can also be represented as $0.022222\dots {}= 0.0\bar{2}$ and we'll make an exception and choose this as the ternary expansion of $2/3$. Similarly, for consistency we can choose the ternary expansion of $1$ to be $0.22222\dots {}=0.\bar{2}$ instead of $1.00000\dots$. In general, if $x$ has a ternary expansions ending in an infinite string of twos, then we will choose that over a representation ending in an infinite string of zeros.
Conversely, any real number in $[0,1]$ whose ternary expansion consists only of $0$'s and $2$'s is in the Cantor set by the same reasoning: the numbers that are removed in the construction of the Cantor set are precisely those that have a $1$ somewhere in their ternary expansion.
Now, to show that the Cantor set is perfect, it suffices to show that every point in $C$ is a limit point of $C$. So, let $x \in C$. Then, $x$ has a ternary expansion of the form $0.x_1 x_2 x_3 \dots$ where each $x_n$ is either $0$ or $2$. The sequence of numbers $y_k = 0.x_1x_2\dots x_k$, formed by truncating the ternary expansion at the $k$th position, clearly converges to $x$. Moreover, $y_k \in C$ for each $k$ because its ternary expansion consists only of $0$'s and $2$'s. Hence, $x$ is a limit point of $C$, and so $C$ is perfect.