in reply to finding length of encrypted(binary) string

You can enforce the string to be treated as pure bytes, by pushing it through an incantation of pack. Then, length will work.
my $bytes_string = pack 'C0a*', $string; my $bytecount = length $bytes_string;