JJ004 has asked for the wisdom of the Perl Monks concerning the following question:
#!/usr/bin/perl print "Content-type:text/html\n\n"; #http://xxrainxx.tripod.com/cgi-bin/mboard.html test page #http://xxrainxx.tripod.com/cgi-bin/postall.txt text file open (INF,"postall.txt") or dienice("Couldn't open postall.txt for re +ading: $!"); $subject = $ENV{'QUERY_STRING'}; $subject =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C",hex($1))/eg; $subject =~ tr/_/ /; @b = <INF>; close (INF); print <<"EndHTML"; <html><head><title>$subject</title></head> <body bgcolor="#000000" text="#DDFFDD" face="Verdana,Helvetica,Arial"> +\n $ENV{'QUERY_STRING'}\n<br> $subject\n<br> <br> <blockquote> Here's the message:\n<br>\n<br>\n EndHTML print "$subject this is what I'm looking for<br>\n"; for ($x=1;$x < scalar @b;$x++) { if($b[$x]=="***Begin $subject"){ while ($b[$x]!="***Begin Here***\n"){ print "$b[$x]<br>\n"; $x = $x + 1; } } } #foreach $line (@b){ # chomp($line); # print "$line<br>\n"; #} # I removed a section of html when posting because last time closing t +he textarea broke the preview text field. sub dienice { my($msg) = @_; print "<h2>Error</h2>\n"; print "$msg;\n"; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: searching a text file
by Zaxo (Archbishop) on Oct 23, 2001 at 08:31 UTC | |
|
Re: searching a text file
by Zecho (Hermit) on Oct 23, 2001 at 11:17 UTC | |
|
Re: searching a text file
by the_0ne (Pilgrim) on Oct 23, 2001 at 08:14 UTC | |
by JJ004 (Initiate) on Oct 23, 2001 at 08:27 UTC |