Finally nailed this perl one liner