List :: Util :: pairs.
use List::Util 'pairs'; my @zipped = ('1', 'A', '2', 'B', '3', 'C'); my ($foo, $bar) = pairs @zipped;
$foo and $bar will be references to arrays containing ('1'..'3') and ('A'..'C') respectively.
Or, if there are more than two arrays, use List :: MoreUtils :: part:
use List::MoreUtils 'part'; my @zipped = ('1', 'A', 'a', '2', 'B', 'b', '3', 'C', 'c'); my $number_of_arrays = 3; my $i = 0; my @arrayrefs = part { $i++ % $number_of_arrays } @zipped;
source share