Indentation would help readability in an enormous way.
It's not clear why you're calling use vars for some simple globals. You can probably just declare them with my as usual, unless you are using them in other modules, which is a scary thought anyway. Maybe that is
where error_page() lives? Try passing this data as arguments, such as error_page("eins","zwei")
Don't call your subroutines with ampersand, such as &foo, but with brackets, such as foo(). Ampersand is a Perl 4 thing and is slightly dangerous because of how it can work in Perl 5.
Each time through your @$data loop you are reassigning to $res. Maybe you meant to append, such as $res .= "@$_";
It's not clear what you expect $_ to be at the end of your program.