Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
What I want to do is scan a dir and find the file with the biggest
name ( Example 1.txt, 2.txt ), then print that to the browser.
$greatest = -1;
opendir "/data", DIR || die "no open data";
while($file = readdir DIR) {$greatest = $file if $file gt $greatest;}
closedir DIR;
print "Content-type: text/html\n\n";
open (DATA, "<$greatest") || die "poop";
@array = <DATA>;
foreach $item (@array) {print $item};
close (DATA);
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Argh
by athomason (Curate) on Oct 22, 2000 at 10:32 UTC | |
|
Re: Argh
by chromatic (Archbishop) on Oct 23, 2000 at 05:32 UTC | |
|
Re: Argh
by AgentM (Curate) on Oct 22, 2000 at 10:42 UTC |