in reply to Re: Re: Re: Size of scalar in bytes
in thread Size of scalar in bytes

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]; }