length() returns the length in characters, which for ASCII is also the number of bytes. To get the bits, just multiply by 8.
If you are using a Unicode character set instead, I'm not too sure what will be returned, or how you can convert it to bits.
#!/usr/bin/perl -wl use utf8; sub bytes ($) { use bytes; length $_[0]; } $x = chr 123456; print length $x, " chars"; print bytes $x, " bytes";
-zsdc.
-- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]