|Welcome to the Monastery|
> > Global symbol "$cmd" requires explicit package name at ...
> That means you have a variable "$cmd" on line 32, which you failed to declare with my $cmd or a similar statement.
I wonder if nowadays the error message shouldn't be updated to something "requires explicit package name or lexical "my" declaration ..."
Lexicals replaced package vars as a standard long ago, maybe the feedback should reflect the most probable cause.
I'm aware that changing the message might confuse some parsers, but it's such a common question here that it's worth a rethink.
( addicted to the Perl Programming Language)