[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

[MacPerl] Packing question. :-)



Try this program:

#!/usr/local/bin/perl

    @mine = ();
    $mine[++$#mine][0] = "This ";
    $mine[$#mine][1] = "is ";
    $mine[$#mine][2] = "a ";
    $mine[$#mine][3] = "test. ";
    $mine[++$#mine][0] = "This ";
    $mine[$#mine][1] = "is ";
    $mine[$#mine][2] = "a ";
    $mine[$#mine][3] = "test. ";
    $mine[++$#mine][0] = "This ";
    $mine[$#mine][1] = "is ";
    $mine[$#mine][2] = "a ";
    $mine[$#mine][3] = "test. ";
    $mine[++$#mine][0] = "This ";
    $mine[$#mine][1] = "is ";
    $mine[$#mine][2] = "a ";
    $mine[$#mine][3] = "test. ";
    $mine[++$#mine][0] = "This ";
    $mine[$#mine][1] = "is ";
    $mine[$#mine][2] = "a ";
    $mine[$#mine][3] = "test. ";
    $mine[++$#mine][0] = "This ";
    $mine[$#mine][1] = "is ";
    $mine[$#mine][2] = "a ";
    $mine[$#mine][3] = "test. ";
    $mine[++$#mine][0] = "This ";
    $mine[$#mine][1] = "is ";
    $mine[$#mine][2] = "a ";
    $mine[$#mine][3] = "test. ";
    $mine[++$#mine][0] = "This ";
    $mine[$#mine][1] = "is ";
    $mine[$#mine][2] = "a ";
    $mine[$#mine][3] = "test. ";
    $mine[++$#mine][0] = "This ";
    $mine[$#mine][1] = "is ";
    $mine[$#mine][2] = "a ";
    $mine[$#mine][3] = "test. ";

    $newLine = pack( "AAAA", @mine[0] );
    $newLine = pack( "AAAA", $mine[0] );
    $newLine = pack( "AAAA", $mine[0][0] );
    print "$newLine\n";
    exit( 0 );

The first one returns "AAAA".  The second one returns "AAAA".  The third
one returns "T".

Why?

Signed - confused but still working on it.  :-)

***** Want to unsubscribe from this list?
***** Send mail with body "unsubscribe" to mac-perl-request@iis.ee.ethz.ch