Dissatisfied with its narrow defeat in Perak, Pakatan Rakyat is mulling legal action to challenge the outcome of the state election.