There is no real difference, what really matters here is the ordering of commands; in both cases you should write your own 'query' parser, since CGI.pm will not help you with this.
There are many interesting articles about this topic at The Restful web.