Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re: Sorry message

by c-era (Curate)
on Apr 03, 2001 at 16:08 UTC ( [id://69269]=note: print w/replies, xml ) Need Help??


in reply to Sorry message

Make sure you use the <code> tages, then your code will look like this:
#!/usr/bin/perl5 require "get_form_data.pl"; &get_form_data(); $search_term = $FORM{'search'}; print "Content-type: text/html\n\n"; opendir(DIR, "."); while($file = readdir(DIR)) { next if($file !~ /.html/); open(FILE, $file); $found_match = 0; $title = ""; while() { if(/$search_term/i) { $found_match = 1; } if((//) || ($found_title)) { if((/<\/TITLE>/) && (//)) { chop; $title = $_; $title =~ s///g; $title =~ s/<\/TITLE>//g; } else { if($found_title == 1) { $title = $_; $found_title = 2 } elsif($found_title == 2) { $found_title = 0; } else { $found_title = 1; } } } } if($found_match) { print "<A HREF=\"$file\">$title</A>\n"; print "<BR>\n"; } close(FILE); } closedir(DIR); exit;
An easy way to do what you want is to add another variable, and if a match is found put a 1 in it. At the end of your script if the variable == 0 then print your sorry message.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://69269]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others avoiding work at the Monastery: (7)
As of 2024-04-24 07:20 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found