here is the background:
i am trying to write a web-based program that will work as a journal. i have the section that will write to the file; i have the section that will read the entire file and print it to the screen; now i am working on getting the search section working and am running into a prob.
journal file ex.:
Code:
Journal date: Fri Aug 29 19:34:12 EDT 2003
I had a bla bla day and spent bla bla dollars getting bla a bla.
The bla yelled at me due to the fact that I am bla at bla.
subroutine snippit:
Code:
sub SEARCH {
open (SEARCH, "</var/www/cgi-bin/journal.txt") ||
print "<h1>Sorry, But your journal cannot be found</h1>";
$searchjournal = <SEARCH>;
close (SEARCH);
print $searchjournal;
}
the output to the browser is
Code:
Journal date: Fri Aug 29 19:34:12 EDT 2003
when you would think that it would be
Code:
Journal date: Fri Aug 29 19:34:12 EDT 2003 I had a bla bla day and spent bla bla dollars getting bla a bla. The bla yelled at me due to the fact that I am bla at bla.
i am trying to split on the "Journal date:\s\s" and leave each date and entry all in one element of the array
what i am planning on doing:
[code]
sub SEARCH {
open (SEARCH, "</var/www/cgi-bin/journal.txt") || print "<h1>Sorry, But your journal cannot be found</h1>";
$searchjournal = <SEARCH>;
close (SEARCH);
@entries = split (/Journal\sdate\:\s\s/, $searchjournal)
}
my theory should work but isn't. can someone point out what is wrong or where i should go with this??
thanks