I have this simple cgi script working just fine but I want to add regex capabilities. is that possible? if so what I need to add. thanks.
#!/usr/local/bin/perl
read(STDIN, $buffer,$ENV{'CONTENT_LENGTH'});
@pairs = split(/&/, $buffer);
foreach $pair (@pairs) {
($key, $value) = split(/=/, $pair);
foreach $pair (@pairs) {
($key, $value) = split(/=/, $pair);
$value =~ tr/+/ /;
$value =~ s/%([a-zA-Z0-9][a-zA-Z0-9])/pack("C", hex($1))/eg;
$formdata{$key}.= "$value";
}
}
$search = $formdata{'search'};
open(INFO, "/test/myfile");
@array=<INFO>;
close (INFO);
…code truncate
To find lines that end with “.cgi”: