Sure, but then you might be better off with another array, rather than a hash as the node title requested:
#! perl
use strict;
use warnings;
my @array1 = qw(red blue green);
my @array2 = qw(black orange white);
my @params;
push @params, shift(@array1) . ':' . shift(@array2) while @array1;
print join(',', @params), "\n";
Output:
22:16 >perl 977_SoPW.pl
red:black,blue:orange,green:white
22:20 >
Update: The above removes the elements from @array1 and @array2. For a non-destructive solution, we can again use pairwise:
#! perl
use strict;
use warnings;
use List::MoreUtils 'pairwise';
use Data::Dump;
my @array1 = qw(red blue green);
my @array2 = qw(black orange white);
my @params = pairwise { $a . ':' . $b } @array1, @array2;
dd \@array1;
dd \@array2;
print join(',', @params), "\n";
Output:
23:51 >perl 977_SoPW.pl
["red", "blue", "green"]
["black", "orange", "white"]
red:black,blue:orange,green:white
23:51 >
Hope that helps,
|