in reply to Problem in displaying files

you can also try this logic :
while($file = readdir($dh)) { next if $file eq '.'; next if $file eq '..'; }