Perl Programming Question:
Download Questions PDF

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

Answer:

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 "$filen";
}

Download Perl Programming Interview Questions And Answers PDF

Previous QuestionNext Question
How to open and read data files with PerlHow do I generate a list of all .html files in a directory?