> Have you read the pack and unpack tutorial?
>
> perldoc perlpacktut
Thanks for this, I missed this one.
>
>
> > Q1. Can I expect that pack can do this for me ?
> > - compress a text file in smaller size
>
> You could implement a compression algorithm with pack/unpack, if you really
> wanted to.
>
> > - 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. I
can't do random read write with a text file anyway, right ? So I don't want to use 'A'
or 'a' as pack templates.
However, as the file is in a binary, I think there could be a size benfit for me to
compress the data length. Actually, am I on the right point for starrting this ? Any
starting hints ? or very simple example perhaprs ?
> > my = qw/a A Z b B h H c C s S i I l L n N v V j J f d F p P u U w x X/;
> >
> > for ()
> > { eval "
> print " ->"; @back = unpack "333", (pack "333", @arr); print "<$_>" for @back; print
> "\n"; " };
>
> You *DO* *NOT* have to use eval() to do that! The format strings are
> interpolated just like any other string.
hehe... sorry for bugging =)
I made this for other copy paste job for me to eval the template vs result experiment.