in reply to Re^2: Counting bytes in a Unicode document
in thread Counting bytes in a Unicode document

Indeed,

The bytes pragma is in core and

require bytes; 
bytes::length($data);
 

does the job.

Cheers Rolf
(addicted to the Perl Programming Language :)
see Wikisyntax for the Monastery

  • Comment on Re^3: Counting bytes in a Unicode document

Replies are listed 'Best First'.
Re^4: Counting bytes in a Unicode document
by ikegami (Patriarch) on Oct 08, 2024 at 15:49 UTC

    Both of those hacks will fail on Windows or if a decoding error occurs.

      You mean both bytes hacks, or also removing the utf8 flag manually?

      In any case, isn't that a bug?

      Cheers Rolf
      (addicted to the Perl Programming Language :)
      see Wikisyntax for the Monastery

        No, it's not a bug that they don't return the size of something that's not passed to them.

        If anything, I would consider using either of those a bug. It's hard to imagine a reason to use them.