Not correctly it won't.
#!/usr/bin/perl use strict; use warnings; use open qw( :encoding(UTF-8) :std ); use Modern::Perl; my $string = ('X' x 400) . '.'; say length $string; # Prints 401 $string =~ s[^.{1,400}\.\K.*?$][]; say length $string; # Prints 401
It will also truncate a string in the middle of a character. And it won't truncate a string that doesn't have a FULL STOP (U+002E) in it.
In reply to Re^2: Truncating after the last period
by Jim
in thread Truncating after the last period
by sdyates
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |