This code works without the strict function but I was just wondering can anyone work out why it won't work with the "use strict" function?
#!/perl/bin/perl -w
use CGI;
$query = CGI::new();
$text1=$query ->param("intext");
$pattern=$query ->param("pattern");
print $query ->header();
print $query ->p("(1i) The Inputted Text: $text1\n");
print $query ->p("(1ii) The Inputted Pattern: $pattern\n");
($newtext = $text1) =~ s/\s+//g;
print $query ->p("(2i) The Text to be searched with spaces removed: $newtext");
($newpattern = $pattern) =~ s/\s+//g;
print $query ->p("(2ii) The Pattern to be matched for with spaces removed: $newpattern");
if ( $newtext =~ /^\s*$/)
{
print $query ->p("(3i) The text box was found to be BLANK. Please Try Again.");
}
else
{
print $query ->p("(3ii) The text box was NOT found to be blank.");
}
if ( $newpattern =~ /^\s*$/)
{
print $query ->p("(3iii) The pattern box was found to be BLANK. Please Try Again.");
}
else
{
print $query ->p("(3iv) The pattern box was NOT found to be blank.");
}
if ( $newtext =~ /[^AaGgCcTtUu]/)
{
print $query ->p("(4i) Problems have been found with the syntax of the text. Please Check Or Try Again.");
}
else
{
print $query ->p("(4ii) The syntax of the text is Correct.");
}
if ( $newpattern =~ /[^AaGgCcTtUu|\*]/)
{
print $query ->p("(4iii) Problems have been found with the syntax of the pattern. Please Check Or Try Again.");
}
else
{
print $query ->p("(4iv)The syntax of the pattern is Correct.");
}
if ( $newpattern =~ /(\*.){2,}|(\*){2,}|\*$/) #These are the only ways in which two stars can be together
{
print $query ->p("(5i)Minimum of Two stars present:Bad");
}
else
{
print $query ->p("(5ii)Not Minimum of two stars present: Good");
}
$newtext =~ tr/A-Z/a-z/; # convert to lower case $newpattern =~ tr/A-Z/a-z/;
# convert to lower case
if ( $newtext =~ /$newpattern/)
{
print $query ->p("(6i)A Match Was Found");
}
else
{
print $query ->p("(6ii)No match was found");
}
($regex = $newpattern) =~ s/\*(.)/.*[^$1](.*?)/g;
if ($newtext =~ /($regex)(?!.*?$regex)/)
{
print $query->p("(7)The excellent match was found at position $-[0]");
}
#!/perl/bin/perl -w
use CGI;
$query = CGI::new();
$text1=$query ->param("intext");
$pattern=$query ->param("pattern");
print $query ->header();
print $query ->p("(1i) The Inputted Text: $text1\n");
print $query ->p("(1ii) The Inputted Pattern: $pattern\n");
($newtext = $text1) =~ s/\s+//g;
print $query ->p("(2i) The Text to be searched with spaces removed: $newtext");
($newpattern = $pattern) =~ s/\s+//g;
print $query ->p("(2ii) The Pattern to be matched for with spaces removed: $newpattern");
if ( $newtext =~ /^\s*$/)
{
print $query ->p("(3i) The text box was found to be BLANK. Please Try Again.");
}
else
{
print $query ->p("(3ii) The text box was NOT found to be blank.");
}
if ( $newpattern =~ /^\s*$/)
{
print $query ->p("(3iii) The pattern box was found to be BLANK. Please Try Again.");
}
else
{
print $query ->p("(3iv) The pattern box was NOT found to be blank.");
}
if ( $newtext =~ /[^AaGgCcTtUu]/)
{
print $query ->p("(4i) Problems have been found with the syntax of the text. Please Check Or Try Again.");
}
else
{
print $query ->p("(4ii) The syntax of the text is Correct.");
}
if ( $newpattern =~ /[^AaGgCcTtUu|\*]/)
{
print $query ->p("(4iii) Problems have been found with the syntax of the pattern. Please Check Or Try Again.");
}
else
{
print $query ->p("(4iv)The syntax of the pattern is Correct.");
}
if ( $newpattern =~ /(\*.){2,}|(\*){2,}|\*$/) #These are the only ways in which two stars can be together
{
print $query ->p("(5i)Minimum of Two stars present:Bad");
}
else
{
print $query ->p("(5ii)Not Minimum of two stars present: Good");
}
$newtext =~ tr/A-Z/a-z/; # convert to lower case $newpattern =~ tr/A-Z/a-z/;
# convert to lower case
if ( $newtext =~ /$newpattern/)
{
print $query ->p("(6i)A Match Was Found");
}
else
{
print $query ->p("(6ii)No match was found");
}
($regex = $newpattern) =~ s/\*(.)/.*[^$1](.*?)/g;
if ($newtext =~ /($regex)(?!.*?$regex)/)
{
print $query->p("(7)The excellent match was found at position $-[0]");
}