my $s = 'variable chars anchor want this'; #### $s = 'anchor want this'; #### if( $s =~ m/^.*?(anchor.*)$/ ){ $s = $1; } #### if( $s =~ m/^(.*?)anchor/ ){ my $bad = $1; $s =~ s/$bad//; } #### $s =~ s/^.*?anchor/anchor/; #### e.g., loops that utilize reverse, chop, split, ...