Perl::...Substr(3pm)
π NAME π
okay so this is Perl::...Substr(3pm) from User Contributed Perl Documentation, and it's the manual for Perl::Critic::Policy::BuiltinFunctions::ProhibitLvalueSubstr. The whole vibe: use the 4-argument substr instead of writing substr($foo, 2, 6) = $bar. That's the policy. Slay. π
π«Ά AFFILIATION π«Ά
This Policy is part of the core Perl::Critic distribution. No cap. π«Ά
β¨ DESCRIPTION β¨
Conway discourages using substr() as an lvalue. Instead, the recommendation is to use the 4-argument version of substr(). Like:
substr($something, 1, 2) = $newvalue; # not ok
substr($something, 1, 2, $newvalue); # ok
The four-argument form of substr() was introduced in Perl 5.005 β iconic. This policy does not report violations on code which explicitly specifies an earlier version of Perl (e.g. use 5.004;), so it's not gonna come for that code. π¦
π CONFIGURATION π
This Policy is not configurable except for the standard options. Literally just the standard options, bestie. π
π¦ SEE ALSO π¦
"substr" in perlfunc(or runperldoc -f substr)."4th argument to substr" in perl5005delta
πΈ AUTHOR πΈ
Graham TerMarsch <graham@howlingfrog.com> β periodt. πΈ
π COPYRIGHT π
Copyright (c) 2005-2011 Graham TerMarsch. All rights reserved.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
xoxo, your local manual page π
β footer tea: perl v5.42.0, dated 2024-10-23. Byeee! π¦
π¦ where this page comes from
- opensuse-leap 16.0: perl-Perl-Critic 1.156.0-bp160.1.1 Β· Artistic-1.0 OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms