Two Perth men who allegedly tried to hold up a pharmacy in Perth's south accidentally foiled their own plans after one squirted himself in the face with pepper spray and the other cut himself with a knife he was threatening staff with.

The Dumb & Dumber pair allegedly escaped the Shoalwater scene stealing only sleep apnoea masks after a confrontation with staff spilled into the pharmacy carpark.

The robbery skills of the pair left little to be desired, with police claiming one of the men sprayed himself in the face with pepper spray while trying to spray the pharmacist.

"The canister was facing the wrong way and man sprayed himself," a police spokeswoman said.