Bee wrote:
>>>>>    - besize template 'aAuU', anything else tempplate I can use to
>>>>>    prepare fix length data ? - if yes, but how do I assuming the
>>>>>    block size is? In case,  if I write a binary file and I wanna
>>>>>    use seek.
>>>>
>>>>You are going to have to explain that in more detail.
>>>
>>>In case, I am doing something like a log with User v TimesOfSignIn.
>>>So, user name will set as 30 char long, and the Signin times is about
>>>in scope of a normal integer. I wanna make this a simple DB for this
>>>but not a list of single files for each user. So I wanna make this
>>>doable for ramdom read write, so, that should be in a binary file. 
>>
>>You want to have a look at DBM files. Read
>>      perldoc DB_File
>>or
>>      perldoc SDBM_File
>>
>>Or you may try to install DBD::SQLite. That would give you the full 
>>power of SQL without having to install anything but the module.
>>
>> > However, as the file is in a binary, I think there could be a size
>>
>>>benfit for me to compress the data length. 
>>
>>      "Premature optimization is the root of all evil."
>>
>>How many users are we talking about? Millions? I would not sweat over 
>>a few KB you might save.
> 
> 
> Yes, that's very right, I should have to do that with some db modules!!! I
> am sorry I missed something to declare here . I just do it as an experiment
> to know and learn how pack works in this ways. 
> 
> So, I still looking for a pack way to get this job done. Actaully, I am still
> quite confuse on what I can expect pack and unpack can giving help to me,
> in furture. I guess I would have some light to know what pack is while this 
> get done. 

pack and unpack simply provide a way to translate the bits of a string
in a specific way. eg. you can look at a string of bits as a series of
32-bit signed integers or you can look at the same string as a series of
8-bit characters. (It's sort of like a casting operator in C/C++.) It
provides a way of looking at or storing data in a very specific way.
It's primary use is looking at or creating binary data to be shared with
other (C-like) applications.

Randy.

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to