Add perl solution to challenge 40

Signed-off-by: James Durand