First, I have to say thank you for those buddies that replies my thread on Conceptual question about pack. I just back from from vocation, so say howdy...
For pack, I have do some more experiments, and I guess I could gereralize something... but that's quite a terrible founding, very far out of my imagination. Maybe I've missed something, please point out ! Recall to my very first idea to why I ask about pack is because I want to random read write a file, so, I have up to making a binary file. After some study, Then, I put my focus on 'pack'. Yet, I still not find anything on pack can do something like that : $binarydata = pack "H*', $ascii_str; $ascii_str = unpack "H*", $binarydata; After pack, I don't know what is that packed thing is, and I never able to get back my origional string, but something that really weir that I can figure out. All what I found on pack is just use it to do something like sprintf, or some regex. The examples that I ever seen is to use a, A, u, U for text, h, l, something for numbers. So I still found no way to use pack for dealing with a text string to becomes a binary data. Anyway, I still wondering if this can be happen to translate a string to binary data at once ? I've tried some of patterns that turns a number to become a binary data by pack, and save it to a file, and write : die unless -B $file. They did a binary file, but when full of text, they are not ! Why ? So I write in this way : open F, $file ; binmode F; print F chr 0; print F "Hello World" ; close F; die "Not a bin!\n" unless -B $file # This time, it is a binary file !!! I can do random read write finally !!! YES!! Is that Perl treats a file with char(s) that [^\d\w\s] is a binary file !? or does a binary file is just something like that ? In case, I don't even have to use pack... So what's that stand point to say pack prepares for binary data ? All in my head are question marks.... Would anybody point me out or giving me some more reference ? Thanks in advise