All I want to do is print 'yeppers' if the output from a text file has the word 'cat'. But I cannot get it to work. Here is the code. Any suggestions would be great. and why am I doing this on Friday night? I'm Not Proud
#!/usr/local/bin/perl -w use strict print "Content-Type: text/html\n\n"; print "<html>\n"; print "<body bgcolor=fffbbf>\n"; #this chunk of code out put the input box. Got me? read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'}); @pairs = split(/&/, $buffer); foreach $pair (@pairs) { ($name, $value) = split(/=/, $pair); $value =~ tr/+/ /; $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg; $value =~ s/~!/ ~!/g; $value =~ s/\s*$//; $FORM{$name} = $value; # print "$FORM{$name} = $value<br>\n"; } #this is the end of the output code. Got me? $readthis = 'd:/209.35.237.237/perl/regex/work.txt'; open(READTHIS, "< $readthis") or die "I can't open readthis: $!\n"; print (<READTHIS>); print "<br>\n"; print $value; print "<p>\n"; #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ #this is the code I can not get to work #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ while ($line = <READTHIS>) { if ($line =~ /cat/) { print "yeppers!"; } } #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ print <<EOF; <form name="textwrite" action="work.pl" method="post"> enter something: <input type="text" name="thisone" size="30"> <br> <input type="submit" value="submit"> </form> EOF print "<br></body>\n"; print "</html>";
In reply to reg ex matching 101 by NotProud
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |