if (($leapString) =~ m/$vldbString/i) { $found = 1; break; # <-- here, the equivalent to 'break' would be 'last'; # but you probably meant 'next;' ? }