my $template_data = "/cgi-bin\\content\\unsecure\\".$filename; #### #!/usr/bin/perl -w # ensure all fatals go to browser during debugging and set-up # comment this BEGIN block out on production code for security BEGIN { $|=1; print "Content-type: text/html\n\n"; use CGI::Carp('fatalsToBrowser'); } use CGI ':standard'; my $find = param("name"); my $filename = "template_data_test.txt"; my $fullpath = "/full/path/to/cgi-bin/content/unsecure/" . $filename; open IN, $fullpath or die_nice("Can't open $fullpath, perl says $!\n"); my $found_it = 0; while () { /^([^*])\*/; if ( $find eq $1 ) { $found_it = 1; last; } } close IN; if ($found_it) { # do found it stuff print "Found it!\n"; } else { # do didn't find it stuff print "Did not find it!\n"; } sub die_nice { print "Content-type: text/html\n\n"; print "Error " . shift; require Cwd; print "By the way the current working directory is " . Cwd::getcwd(); print "\nYou can use this to get your path right!"; exit; }