Interviewer And Interviewee Guide

Perl Programming Interview Question:

How do I generate a list of all .html files in a directory?

Submitted by: Administrator
Here's a snippet of code that just prints a listing of every file in the current directory that ends with the extension .html:
#!/usr/bin/perl -w
opendir(DIR, ".");
@files = grep(/.html$/,readdir(DIR));
closedir(DIR);
foreach $file (@files) {
print "$filen";
}
Submitted by: Administrator

Read Online Perl Programming Job Interview Questions And Answers
Copyright 2007-2024 by Interview Questions Answers .ORG All Rights Reserved.
https://InterviewQuestionsAnswers.ORG.