Hello All,
I am working on a simple program that will counts the number of matches found. I then need to display the text of the last successful pattern and the text the preceeds the last successful pattern match. This is where my problem is. How can I get these matches to display?
Here is my code so far:
#!/usr/local/bin/perl
use English;
$string = "This is my string this is it. I want to tie my string";
$count = 0;
while ($string =~ m/[string]/gi)
{
$count=$count+1;
}
print "$count strings\n";
print "\n Match: $MATCH";
print "\n PreMatch: $PREMATCH";
Any assistance will be greatly appreciated.
Thanks,