There are a few ways you could do this, the easiest would be to use a regular expression ...

Code

my($cmd,$rest) = $string =~ m/^\W(\w)\W(.*)$/;

However, that's very forgiving in what would work (ie, you could use :cmd:var|1/blah|hi+mom or "cmd"var?1:blah and it would still carve the string up appropriately), so you might want something a little more restrictive...