foreach (@getcert) { $c = $_; #### foreach my $c (@getcert) { #### use List::MoreUtils qw( mesh ); my @users = qw( alice bob charlie ); my @ids = qw( 123 456 789 ); my %id_of = mesh @users, @ids; # now $id_of{ 'alice' } == 123 #### sub mesh (\@\@;\@\@\@\@\@\@\@\@\@\@\@\@\@\@\@\@\@\@\@\@\@\@\@\@\@\@\@\@\@\@) { my $max = -1; $max < $#$_ && ($max = $#$_) for @_; map { my $ix = $_; map $_->[$ix], @_; } 0..$max; }