with newer Perls. But I need to use that in a script that could be used with $] >= 5.00503 (or maybe even before thanks to some ISPs). So, how do I know when to use it (which versions) and also how to code it -- can't wrap "use bytes" in an eval.$byte_length = do { use bytes; length $str };
This thread discusses some other methods to detecting the string length. Although I'd rather get direct access like Devel::Peek does instead of counting bytes in a loop.
In reply to Portable string length in bytes by moseley
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |