dushu has asked for the wisdom of the Perl Monks concerning the following question:
The files I need to access are in a directory like this: kp/kp021020/files_to_search. The dir depends on which file the user enters in the form.#!/usr/bin/perl print "Content-type: text/html\n\n"; require("cgi-lib.cgi"); &ReadParse; @stuff = ""; $i = 0; foreach $key (keys %in) { @stuff[$i] = "$in{$key}"; $i = $i + 1; } chomp @stuff; $site = @stuff[4]; $year = @stuff[1]; $month = @stuff[5]; $day = @stuff[6]; $star = @stuff[2]; $var = @stuff[0]; $date = $year . $month . $day; $dir = $site . $date; #opendir DIR, "/www2/hardwiredsolutions.com/concam/$site/$dir" or die +"\nError opening directory"; @filecheck = <*.txt>; foreach $file (@filecheck) { open FILE, "$file" or die "\nError reading file(1)"; @lines = <FILE>; close FILE; open FILE, "$file" or die "\nError reading file(2)"; foreach $line (@lines) { @time = unpack "a26a4a2a*", $line; @words = unpack "a6a7a5a4a4a3a6a6a10a9a10a*", $line; s/^\s+// for @time; s/^\s+// for @words; if (@time[1] eq "GST") { chomp @time[3]; print "@time[3]"; } if (@words[1] eq $star) { print "@words[$var+1]<br>"; } } } print <<WEB_PAGE; <html> <title>Graph the Night Sky!</title><h1>Graph:</h1><hr> You researched $star, on $date, at $site, for $var. </html> WEB_PAGE
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: open dir
by emilford (Friar) on Nov 07, 2002 at 17:28 UTC | |
|
Re: open dir
by tachyon (Chancellor) on Nov 07, 2002 at 17:31 UTC | |
|
Re: open dir
by samurai (Monk) on Nov 07, 2002 at 18:15 UTC | |
|
Re: open dir
by fglock (Vicar) on Nov 07, 2002 at 17:51 UTC |