opendir(ODIR, "$sr_data/f") || die ("Unable to open directory $sr_data/f"); @intl_files = grep !/^\./, readdir ODIR; #this line gets rid of . and .. closedir ODIR; open(FILE,">$includes_codes_dir/sc_intl_dd.txt"); foreach $file (sort @intl_files) { $file =~ s/\.\w+$//; #remove the extension print FILE "\n"; } close(FILE);