Best practice is to start code with warnings & strict turned on
Code:
#!/usr/bin/perl -w
use strict;
It would also help if you showed the error msgs you're getting.
Incidentally, you should add error handling to closedir as well.
I'd guess at least one problem is you are opening a DIR to read, but you're not changing to that dir ( chdir() ), so the cat is working in the the wrong dir.
http://perldoc.perl.org/