From: Mischa POSLAWSKY Date: Mon, 21 Feb 2022 13:25:00 +0000 (+0100) Subject: annotate intentional lvalue substr X-Git-Tag: v1.08~32 X-Git-Url: http://git.shiar.net/barcat.git/commitdiff_plain/2e10a32f7851b523529febb4e002f3df421568a7 annotate intentional lvalue substr Advised against by perlcritic and PBP because of confusion and efficiency. The latter seems contrary to actual benchmark results in v5.24-5.28, where this form is at least 5% faster (even with a dummy length argument). --- diff --git a/barcat b/barcat index b0237c4..8796248 100755 --- a/barcat +++ b/barcat @@ -162,6 +162,7 @@ while (defined ($_ = $opt{input} ? shift @{ $opt{input} } : readline)) { $_ = substr $_, 0, 2; } elsif (length > $trimpos) { + # cut and replace (intentional lvalue for speed, contrary to PBP) substr($_, $trimpos - 1) = '…'; } }