in reply to how to store binary string?

If it's in a file, you just read the file into the string and don't worry.

From the perlfaq (perldoc -q "How can I read in an entire file all at once?"):

{ local(*INPUT, $/); open (INPUT, $file) || die "can't open $file: $!"; binmode INPUT; # needed if you are on Windows $var = <INPUT>; }

Replies are listed 'Best First'.
Re^2: how to store binary string?
by polettix (Vicar) on May 11, 2005 at 23:00 UTC
    You will avoid being biten by Unicode using binmode wherever you need to deal with a stream of bytes; from perldoc -f binmode:
    On some systems (in general, DOS and Windows-based systems) binmode() is necessary when you're not working with a text file. For the sake of porta- bility it is a good idea to always use it when appropriate, and to never use it when it isn't appropriate. Also, people can set their I/O to be by default UTF-8 encoded Unicode, not bytes. In other words: regardless of platform, use bin- mode() on binary data, like for example images.

    Flavio (perl -e 'print(scalar(reverse("\nti.xittelop\@oivalf")))')

    Don't fool yourself.