$s = 'variable chars anchor want this';; $s =~ s[.+(?=anchor)][];; print $s;; anchor want this