m/.{$width}/ #### $text =~ m/.*$endPat$/ #### $text =~ m/$endPat$/ #### substr($text,0-length($endPat)) eq $endPat