Okay, so given all the qualifiers about how this cannot be robust and that there are all sorts of potential security implications (which is probably why
Argv is so complex), you could take 1 of two approaches:
State machine. Crawl the string character by character, keeping track of things like if you opened with a single quote, last saw an equals sign or backslash... Start out with a for (split //) {..., and stash the characters on a buffer. The buffer could be either an independent scalar or $args[-1], depending on taste.
Regular expression with backreferences. This is more challenging, because regular expressions aren't really intended to split up an entire string, but rather grab substrings. Expressions like "[^"]*(?<!\\)" to grab everything between two unescaped double quotes could be helpful, but remember if the command were echo "He said, \"How are you?\"", the intended output from your process would be ($command, @args) = ('echo', 'He said, "How are you?"'), which requires removing the surrounding quotes as well as unescaping.
Note as well there is already a bug with
my ( $command, $argstring ) = split / /, $string, 2; in the case where the executable path contains a space. I personally would go with the state machine; logic is more natural and quiet failures are less common in my experience. It will still require the kind of unescaping discussed with 2). Actually, I would probably just use a string
exec, since someone already did a lot of work developing a shell, but that's not on spec.
#11929 First ask yourself `How would I do this without a computer?' Then have the computer do it the same way.