$lPath=$_[0]; if (-d "$lPath") { opendir(DIR, "$lPath"); @dir = readdir(DIR); closedir(DIR); foreach my $a(@dir) { open(FILE, "< $lPath\\$a") || die "Cannot open file: $lPath\\$a - $!"; print ; close(FILE); } }else {print "ERROR";}