develooper Front page | perl.perl5.porters | Postings from October 1999

Re: [PATCH 5.005_62] First round of unpack

Thread Previous | Thread Next
From:
Gurusamy Sarathy
Date:
October 27, 1999 00:35
Subject:
Re: [PATCH 5.005_62] First round of unpack
Message ID:
199910270741.AAA02624@activestate.com
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".

>  *)  Template of '/' is equivalent to 't/t'.  [This makes it possible
>      to extract more or less arbitrary data with a TEMPLATE of 't'.]
>
>      Example of usage: you want the receiving end to obtain
>        qw(a bc def ghij)
>      but the receiving end does not know what data is there:  you
>      want the receiver look like
>
>	   @out = unpack 't', $string;
>
>      This data may be unpacked as 
>
>	   unpack 'A1 A2 A3 A4', 'abcdefghij';	# Now do transformations:
>	   unpack 't11',  'A1 A2 A3 A4abcdefghij';
>	   unpack 't2/t', 'A211A1 A2 A3 A4abcdefghij';
>	   unpack 't4',   't2/tA211A1 A2 A3 A4abcdefghij';
>	   unpack 't/t',  'A4t2/tA211A1 A2 A3 A4abcdefghij';
>	   unpack 't',    '/A4t2/tA211A1 A2 A3 A4abcdefghij';
>
>      It is not simple for manual coding, but as you can see, this
>      simple extension allows us to achieve our target.

Thanks for throwing up the idea, but are you single-handedly trying to
start a back-to-the-assembler-years movement among the Perl rank and
file?  I'm missing the entire point of all this.  Perhaps some examples
of real-world use will help, but I honestly doubt it. :-)


Sarathy
gsar@ActiveState.com

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About