DEVFYI - Developer Resource - FYI

How do I do fill_in_the_blank for each file in a directory?

Perl Questions and Answers


(Continued from previous question...)

How do I do fill_in_the_blank for each file in a directory?

Here's code that just prints a listing of every file in the current directory:
#!/usr/bin/perl -w
opendir(DIR, ".");
@files = readdir(DIR);
closedir(DIR);
foreach $file (@files) {
print "$file\n";
}

(Continued on next question...)

Other Interview Questions