develooper Front page | perl.perl6.language | Postings from September 2000

Re: pack/unpack is damn unperlish. Explain them as Perl.

Thread Previous | Thread Next
Chaim Frenkel
September 18, 2000 20:56
Re: pack/unpack is damn unperlish. Explain them as Perl.
Message ID:
>>>>> "ST" == Sam Tregar <> writes:

ST> I think you're talking about unpack() here, which I've only used once.  I
ST> think unpack() is usually replaceable by substr() or regexes.  Contrast
ST> that with pack() for which no equivalent replacement is possible, as far
ST> as I know.

Actually not. You need to do some extra nasties to get an integer
from a binary record into a perl scalar and have it be a number. If
you use substr it will be a string. Useless.

Pack takes binary data chops it into bitesize pieces so that perl can
use it correctly.

binary integers stay integers
if they are in the wrong endiness the bits get flipped properly.

un so weiter.

Chaim Frenkel					     Nonlinear Knowledge, Inc.				               +1-718-236-0183

Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About