($thisresult) = ($teststring =~ /([aft][edt].[ftg]...v{2,3})/g); if ($thisresult) { if (!$lastresult) { print "Expression found\n"; } } $lastresult = $thisresult;