  The {\em Fibonacci cube} of dimension $n$, denoted as $\Gamma\_n$, is the
subgraph of the $n$-cube $Q\_n$ induced by vertices with no consecutive 1's. In
an article of 2016 Ashrafi and his co-authors proved the non-existence of
perfect codes in $\Gamma\_n$ for $n\geq 4$. As an open problem the authors
suggest to consider the existence of perfect codes in generalization of
Fibonacci cubes. The most direct generalization is the family $\Gamma\_n(1^s)$
of subgraphs induced by strings without $1^s$ as a substring where $s\geq 2$ is
a given integer. We prove the existence of a perfect code in $\Gamma\_n(1^s)$
for $n=2^p-1$ and $s \geq 3.2^{p-2}$ for any integer $p\geq 2$.
