print "enter path\n"; $path = <>; chomp($path); opendir (DIR, $path) or die $!; while (my $file = readdir(DIR)) { if(-f $file) { print "this is a file--->".$file."\n"; } } closedir(DIR);