http://qs1969.pair.com?node_id=177715

Mahoota has asked for the wisdom of the Perl Monks concerning the following question:

I am trying to write a regular expression that will store the actual string matched as a variable so it can be compared to another string matched in another regular expression.. I have used the following but when i print out $thisresult it seems to have stored 1 (positive) as opposed to the actual string matched. I am trying to write a script that will only print "expression found" if the string matched is not the same as the string matched previously.
$thisresult = ($teststring =~ /[aft][edt].[ftg]...v{2,3}/g); if ($thisresult) {if (!$lastresult) {print "Expression found\n"; } } $lastresult = $thisresult;
Any ideas?

edited: Thu Jun 27 14:24:25 2002 by jeffa - added code tags