$chars = length($scalar); # length in characters # what you probably were looking for
$approx_memory_used =Devel::Size::size($scalar) # including perl's overhead$bytes = do {use bytes; length($scalar)} # length in bytes # bytes may be != chars for unicode strings
In reply to Re: Size of scalar in bytes
by ysth
in thread Size of scalar in bytes
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |