in reply to Re^2: ActivePerl on Win32 storing integers as strings?
in thread ActivePerl on Win32 storing integers as strings?
You're almost there.
As you say, unpack takes a string as its argument. If you supply an integer, then Perl quietly converts it to a (human readable) string for you, just as it does when do print 0; It 'ascii-ises' the number. In C terms, Perl does an itoa() on it.
Conversely, when you pack the number, the string returned contains the machine readable, binary representation embedded within a string. In C terms, it is like doing:
int i = 0; printf( "%s", (char*)&i );
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: ActivePerl on Win32 storing integers as strings?
by LonelyPilgrim (Beadle) on Feb 14, 2012 at 05:59 UTC |