in reply to Re: need to put values (from unpack) into array-ref
in thread need to put values (from unpack) into array-ref

Better yet.

#! perl -slw use strict; use Data::Dumper; my $b = "abefcdghijklmn"; my @a = ( [ 'start 0', unpack '(A1x)*', $b ], [ 'start 1', unpack '(xA1)*', $b ] ); print Dumper \@a; __END__ C:\test>539664 $VAR1 = [ [ 'start 0', 'a', 'e', 'c', 'g', 'i', 'k', 'm' ], [ 'start 1', 'b', 'f', 'd', 'h', 'j', 'l', 'n' ] ];

Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
Lingua non convalesco, consenesco et abolesco. -- Rule 1 has a caveat! -- Who broke the cabal?
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.

Replies are listed 'Best First'.
Re^3: need to put values (from unpack) into array-ref
by japhy (Canon) on Mar 28, 2006 at 13:57 UTC
    Here's another way, although it uses an additional temporary variable...
    my $b = "abefcdghijklmn"; my @a = (['start 0'], ['start 1']); my $i = 0; push @{ $a[$i++ % 2] }, $_ for unpack('(A)*', $b);

    Jeff japhy Pinyan, P.L., P.M., P.O.D, X.S.: Perl, regex, and perl hacker
    How can we ever be the sold short or the cheated, we who for every service have long ago been overpaid? ~~ Meister Eckhart
Re^3: need to put values (from unpack) into array-ref
by jeanluca (Deacon) on Mar 28, 2006 at 11:16 UTC
    THATS IT!!!!!

    Thanks a lot
    Luca