#! /usr/bin/perl -T
use strict;
use warnings;
use File::Slurp 'slurp';
my ($map_file, $pass_file) = @ARGV or die 'No arguments given!';
my %ad_for;
for my $line (slurp($map_file)) {
chomp $line;
my ($unix, $ad) = split / /, $line;
$ad_for{$unix} = $ad;
}
for my $line (slurp($pass_file)) {
my ($name, @entries) = split /:/, $line;
if ($ad_for{$name}) {
print join ':', $ad_for{$name}, @entries;
}
else {
warn "name $name doesn't have an ad entry\n";
}
}