From 2e10a32f7851b523529febb4e002f3df421568a7 Mon Sep 17 00:00:00 2001 From: Mischa POSLAWSKY Date: Mon, 21 Feb 2022 14:25:00 +0100 Subject: [PATCH] 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). --- barcat | 1 + 1 file changed, 1 insertion(+) 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) = '…'; } } -- 2.30.0