The sequence $(a_n)_{n \in\mathbb{N}}$ is defined by $a_1 = 8, a_2 = 18, a_{n+2} = a_{n+1}a_{n}$. Find all terms which are perfect squares.
1. **Define the sequence and initial conditions:**
   The sequence \((a_n)_{n \in \mathbb{N}}\) is defined by:
   \[
   a_1 = 8, \quad a_2 = 18, \quad a_{n+2} = a_{n+1}a_n
   \]

2. **Express \(a_n\) in terms of prime factors:**
   Notice that \(a_n\) can be expressed in terms of its prime factors:
   \[
   a_n = 2^{b_n} \cdot 3^{c_n}
   \]
   where \(b_n\) and \(c_n\) are sequences of exponents of 2 and 3, respectively.

3. **Determine the initial values for \(b_n\) and \(c_n\):**
   From the initial conditions:
   \[
   a_1 = 8 = 2^3 \cdot 3^0 \implies b_1 = 3, \quad c_1 = 0
   \]
   \[
   a_2 = 18 = 2^1 \cdot 3^2 \implies b_2 = 1, \quad c_2 = 2
   \]

4. **Find the recurrence relations for \(b_n\) and \(c_n\):**
   Using the recurrence relation \(a_{n+2} = a_{n+1}a_n\), we get:
   \[
   a_{n+2} = 2^{b_{n+2}} \cdot 3^{c_{n+2}} = (2^{b_{n+1}} \cdot 3^{c_{n+1}}) \cdot (2^{b_n} \cdot 3^{c_n}) = 2^{b_{n+1} + b_n} \cdot 3^{c_{n+1} + c_n}
   \]
   Therefore, the recurrence relations for \(b_n\) and \(c_n\) are:
   \[
   b_{n+2} = b_{n+1} + b_n
   \]
   \[
   c_{n+2} = c_{n+1} + c_n
   \]

5. **Analyze the sequence \(c_n\):**
   The sequence \(c_n\) follows the Fibonacci sequence but shifted:
   \[
   c_n = 2F_{n-1}
   \]
   where \(F_n\) is the Fibonacci sequence. Since \(F_n\) is defined as:
   \[
   F_0 = 0, \quad F_1 = 1, \quad F_{n+2} = F_{n+1} + F_n
   \]
   it follows that \(c_n\) is always even because it is twice a Fibonacci number.

6. **Analyze the sequence \(b_n\):**
   The sequence \(b_n\) can be expressed as:
   \[
   b_n = F_n + 2F_{n-2}
   \]
   where \(F_{-1} = 1\) and \(F_0 = 0\). We need to determine when \(b_n\) is even. It is known that \(F_n\) is even if and only if \(n\) is a multiple of 3.

7. **Determine when \(a_n\) is a perfect square:**
   For \(a_n\) to be a perfect square, both \(b_n\) and \(c_n\) must be even. Since \(c_n\) is always even, we only need to check when \(b_n\) is even. From the analysis, \(b_n\) is even if and only if \(n\) is a multiple of 3.

Conclusion:
\[
a_n \text{ is a perfect square if and only if } 3 \mid n.
\]

The final answer is \( \boxed{ a_n \text{ is a perfect square if and only if } 3 \mid n. } \)