Your code still has the same defect in it.
#!/usr/bin/perl -l use strict; use warnings; my $string = '.' x 400_000_000; print length $string; # Prints 400000000 $string =~ s[^.{1,400}\.\K.*?$][]; print length $string; # Prints 401
It's so easily fixed it boggles the mind you still haven't figured out how to fix it.
In reply to Re^4: Truncating after the last period
by Jim
in thread Truncating after the last period
by sdyates
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |