⭐ in reply to How can I strip an arbitary number of leading spaces from a string?
There is no need to use s/^\s*//. This
will waste time on strings with no leading space.
Use s/^\s+// at all times -- it obviously
won't do anything if there's no whitespace to match.
A general rule of thumb is that s/X*//
is slower than s/X+//, and in cases where
the RHS (right-hand side) is something OTHER than
"", chances are you really do mean X+.