use Getopt::Std; ## This works in general $cmdline = '-a b -c d'; @ARGV = split /\s+/, $cmdline; getopts( "a:c:" ); ### ...but this obviously fails: $cmdline = '-a "hello world" -b "some \"text\""';