|Just another Perl shrine|
Alternative to bytes::length()by creamygoodness (Curate)
|on Dec 23, 2009 at 01:04 UTC||Need Help??|
creamygoodness has asked for the
wisdom of the Perl Monks concerning the following question:
I have often seen people badmouth the bytes pragma, but there's one thing I use it for: cheaply identifying empty strings with bytes::length()when the strings may be carrying the SVf_UTF8 flag. The length() function can be inefficient for such strings, because it must traverse the entire buffer counting characters:
Is there an efficient alternative to bytes::length() for this use case elsewhere in core?