If you allow the group to be finite, any non-alternating finite simple group
is a counterexample. Otherwise you can still obtain counterexamples from
wreath products of such groups with the infinite cyclic group.
To give a specific counterexample: let
$$
G := (\mathbb{Z},+) \wr {\rm PSL}(2,7) \ = \ (\mathbb{Z},+)^8 \rtimes {\rm PSL}(2,7),
$$
where ${\rm PSL}(2,7) \cong \langle (3,7,5)(4,8,6), (1,2,6)(3,4,8) \rangle$
acts on $(\mathbb{Z},+)^8$ by permuting the factors. Then $G'$ is perfect,
it is residually finite as $(\mathbb{Z},+)$ is so, and it does not admit a surjection
to a nontrivial alternating group.
The example can be constructed in GAP as follows:
gap> LoadPackage("rcwa");
gap> G := WreathProduct(CyclicGroup(IsRcwaGroupOverZ,infinity),PSL(2,7));;
gap> StructureDescription(G);
"Z wr PSL(3,2)"
gap> IsPerfect(G); # not yet (as Derek remarked) ...
false
gap> G := DerivedSubgroup(G);; # ... but now we have our example.
gap> IsPerfect(G);
true
gap> StructureDescription(G);
"(Z x Z x Z x Z x Z x Z x Z) . PSL(3,2)"