Frameworks, such as Dancer, are very useful for letting you focus more quickly upon what you want to do, but if you are starting absolutely from-scratch in your understanding of web development (as you seem to be ...), it is critical that you obtain a “big picture” contextual understanding of what is going on. You do need to clearly understand how your web-browser interacts with a web server (both with AJAX and otherwise ...), how the CGI and FastCGI and mod_language work, and so on. You do not need to know these things, initially, in great depth, but you do need to know how the various pieces of the puzzle [can... might... could...] work together. This will become critical when (not “if” ...) something happens that you did not expect. You won’t even know where to look, and so you will waste much time and hair-follicles ... avoidably.
So ... take a step back from “Perl,” and/or Dancer or any particular tool, and get to know the neighborhood. Walk around a little while, before you try to run.