my ( $command, $argstring ) = split / /, $string, 2; # single-quoted args like 'red wagon' my ( @args ) = $argstring =~ s/[[:space:]]+'(.*?)'//g; # double-quoted args, where the closing quote isn't preceded by "\" push @args, $argstring =~ s/[[:space:]]+"(.*?[^\]*)"//g; # args that aren't quoted at all, like --verbose push @args, split / /, $argstring;