in reply to Join 2 arrays horizontally

#!/usr/bin/perl # https://perlmonks.org/?node_id=1230807 use strict; use warnings; my @array1 = qw(host1 host2 host3); my @array2 = qw(ip1 ip2 ip3); my %ip2host; @ip2host{@array2} = @array1; print "$_ $ip2host{$_}\n" for @array2;

Replies are listed 'Best First'.
Re^2: Join 2 arrays horizontally
by tweetiepooh (Hermit) on Mar 04, 2019 at 12:34 UTC

    And depending on how the original data is sourced you may be better off simply creating the hash in the first place.

    my %ip2host = ( ip1 => host1, ip2 => host2, ip3 => host3 );