in reply to Size of scalar in bytes

$chars = length($scalar); # length in characters # what you probably were looking for
$bytes = do {use bytes; length($scalar)} # length in bytes # bytes may be != chars for unicode strings
$approx_memory_used =Devel::Size::size($scalar) # including perl's overhead