in reply to Size of scalar in bytes
$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
|
|---|