Use Getopt::Long for command line parsing

We're parsing the command line options using a loop and string matching.
A better way is to use the Perl core module Getopt::Long. It makes the
code smaller and less complicated.

Signed-off-by: Marcus Karlsson <mk@acc.umu.se>