is there a way to get the number of bytes per character for the encoding in use?
Some encodings use a fixed bytes/character ratio, but some like UTF-8 do not.
As hardburn pointed out, if use bytes is in effect then length() returns the length in bytes rather than characters:
sub byte_length { use bytes; return length $_[0]; }
In reply to Re: Re: Re: Re: Size of scalar in bytes
by grantm
in thread Size of scalar in bytes
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |