On Wed, Oct 27, 1999 at 12:41:11AM -0700, Gurusamy Sarathy wrote: > On Wed, 27 Oct 1999 03:06:54 EDT, Ilya Zakharevich wrote: > >To facilitate complicated data extraction, the following extensions > >are allowed inside embedded templates: > > Sounds like the key word there is "complicated". a) 't' and 'T' without "extensions" are in no way "complicated". b) The extensions may *look* complicated, but note that most of them will cease to be "extensions" the moment we have parens in TEMPLATEs: they will make sense in usual TEMPLATEs as well. c) This leaves '/'-extension and "starts with a digit" extension. The only reason for them is performance: they simplify pack() a lot. Moreover, they make debugging easier, since the packed strings become easier to read by human. Say, packed string "/NtttttPPPPPPP" (here N is a digit, and ttttt is N characters long) when extracted with 't' template means: extract "PPPPPPP" using TEMPLATE 'ttttt'. Similarly with "//dNNNtttttPPPPPPPP" (here d is a digit, NNN is d chars long, and ttttt is NNN chars long). These things are not any tiny bit more complicated that 'A/A/A' templates: they are handled by combinations of simple rules. d) You react as if packed strings are manually created and designed for human consumption. All that programmer are going to do is $packed = pack 't', \%data; system 'foo', $packed; $data = unpack 't', shift; IlyaThread Previous | Thread Next