in reply to how can i also show sub folders

A few notes:

. You can avoid doing stat twice by using the _(underscore) handle:
@stat = stat(_); # the -f test did a stat on the same file

. you can use spritf to simplify your code:
if ($stat[7] > 1000) { $stat[7] = sprintf( "%d KB", int($stat[7] * .001) ); }

Someone else in this monastery will mention the use strict, use warnings, -w,, HTML::Template stuff :)