You already depend on  `List::Util`, why not `any`?

```perl
if (any {m{[;&>|"']} @$cmd) {
```