Parts of your pages are repeating. You would like to encapsulate these parts to make maintainance easier.
If you are using templates, its easy. Write a function that fills a subtemplate and returns it filled in. The return value is interpolated into the main template.
# We fill the login subtemplate
$display{'LOGIN'}	= login($session);
...
# $tmpl is the main template
interpolate(\$tmpl, %display);
Your page layout becomes more modular. If you apply the technique properly, you get something pretty close to a GUI component.