my @pages = (
'frontpage.html',
'aboutus.html',
'login.html',
); # extra comma is there so adding new pages is easier
my $num = CGI::param('Num') || 1;
page($num - 1); # or put a dummy at the start of @pages
sub page {
$| = 1;
my $num = shift;
if (open(FILE, $pages[$num])) {
print while ;
}
}