
sunblaster
Novice
Nov 4, 2011, 5:58 PM
Post #1 of 1
(188 views)
|
|
Perl Tk script is listing all directory files instead of just the ones I need
|
Can't Post
|
|
I have a script that makes several copies of a single file then prints the file names of the copies to a TK txt box, But it prints the entire directory files in the txt box while giving me the "Unable to list files" error. All the copied files have a(x) in the files name, so I am using in the function just to get those filenames.
sub makeCopies{ while ($count < 5){ chdir getcwd; print "$fn\n"; open (FN, $fn) or warn "Unable to open file:$!"; copy($fn,"($count)$fn") or warn "Unable to copy:$!"; $count++; } opendir(DD, $dd) or warn "Unable to open directory"; while ($list = readdir(DD)) { #print "$list\n"; $txt -> insert('end',"$list\n") if $list =~ /\(/ or warn "Unable to list files:$!"; } }
|