nasa has asked for the wisdom of the Perl Monks concerning the following question:
opendir DIR, "start" or die "Can't open: $!"; my @files = grep { /\.txt\z/ } readdir DIR; closedir DIR; print "Content-type: text/html\n\n"; foreach my $file (@files) { open FILE, $file or die "Can't open file: $!"; while (<FILE>) { print $_; } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: print directory contents
by liverpole (Monsignor) on Dec 10, 2006 at 01:48 UTC | |
|
Re: print directory contents
by ikegami (Patriarch) on Dec 10, 2006 at 01:48 UTC | |
|
Re: print directory contents
by madbombX (Hermit) on Dec 10, 2006 at 02:44 UTC | |
|
Re: print directory contents
by Not_a_Number (Prior) on Dec 10, 2006 at 08:08 UTC |