Beefy Boxes and Bandwidth Generously Provided by pair Networks BBQ
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re: Looking through a file...

by zengargoyle (Deacon)
on Mar 31, 2002 at 01:33 UTC ( [id://155569]=note: print w/replies, xml ) Need Help??

This is an archived low-energy page for bots and other anonmyous visitors. Please sign up if you are a human and want to interact.


in reply to Looking through a file...

Try something like this:

# blah blah blah ... print $Page->header; print <<HTMLSTUFF; <body> HTMLSTUFF do_work($Info); print <<HTMLSTUFF; </body> HTMLSTUFF exit; sub do_work { my $Info = shift; print "<p>matching: $Info</p>$/"; if ( $Info =~ / / ) { print "<p>one word only please</p>\n"; return; } unless (open (FILE, "<names.html")) { print "<p>open: $!</p>\n"; return; } my @Names = grep(/$Info/,<FILE>); foreach my $Name (@Names) { print "<p>$Name</p>\n"; } close(FILE); }

Can 'ya tell I don't do much CGI.. :(

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://155569]
help
Sections?
Information?
Find Nodes?
Leftovers?
    Notices?
    hippoepoptai's answer Re: how do I set a cookie and redirect was blessed by hippo!
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.