in reply to how to rm an element from an array?
Start with IO's solution. Then you can extend the pattern-matching part as needed. And avoid the obfuscation of intent caused by using yoink().