in reply to need to put values (from unpack) into array-ref
Somehow I have the feeling this can be done all at once!!#! /usr/bin/perl # use strict ; use warnings ; my $b = "abcdefghijklm" ; my @a ; $a[0]->[0] = "start 0" ; $a[1]->[0] = "start 1" ; for(my $i = 0; $i < 14; $i += 2) { push (@{$a[0]}, $_) for unpack("x$i A1", $b) ; push (@{$a[1]}, $_) for unpack("x".($i+1)." A1", $b) ; } foreach ( @{$a[0]} ) { print "$_\n" ; } foreach ( @{$a[1]} ) { print "$_\n" ; }
|
|---|