$lPath=$_[0]; if (-d $lPath) { my $dir; if(opendir($dir, $lPath)) { while(my $filename = readdir $dir) { next if $filename =~ m!^\.?\.!; my $file;     if(open($file, "< $lPath/$a")) {         print <$file>;           close $file;       }     }     closedir $dir; } } else { print "ERROR" }