frenchface has asked for the wisdom of the Perl Monks concerning the following question:
#!/usr/bin/perl use strict; use warnings; use CGI ':standard'; print header, start_html('Player Point Tracker'), h1('Point Tracker'), start_form, body(''), p, 'Players Name: ', textfield('name'), br, submit('Search!'), end_form, p, hr; my $search_term =param('name'); my $file = '18.txt'; open (my $FILE_HANDLE, '<', $file) || die "Can't open $file: $! \n"; while (<$FILE_HANDLE>) { chomp; my ($word, $count) = split / /, $_; if ($word =~ /^$search_term$/) { print "At 18:00 server time $word had $count p +oints.",p; } } close ($FILE_HANDLE);
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: cgi search all txt files in a directory
by perlpie (Beadle) on Sep 23, 2010 at 00:55 UTC | |
|
Re: cgi search all txt files in a directory
by perlpie (Beadle) on Sep 23, 2010 at 00:52 UTC | |
by frenchface (Initiate) on Sep 23, 2010 at 01:09 UTC | |
by perlpie (Beadle) on Sep 23, 2010 at 03:17 UTC | |
by frenchface (Initiate) on Sep 24, 2010 at 01:01 UTC | |
by frenchface (Initiate) on Sep 23, 2010 at 11:52 UTC |