Matthew Perry had been using the drug through his regular doctor in a legal but off-label treatment for depression that has become increasingly common.