#!/usr/bin/perl
use strict;
use warnings;
open my $CUR, "<", "tdat_cur" or die "no tdat_cur";
open my $IPS, "<", "tdat_ips" or die "no tdat_ips";
my @cur = map { chomp ; $_ } <$CUR>;
my %ips;
foreach ( <$IPS> ) {
# if there's a chance of $nam recurring you need to check for it.
my ($nam, $ip) = split;
$ips{$nam} = $ip;
}
foreach my $curious_about ( @cur ) {
if( defined $ips{$curious_about} ) {
print "$curious_about has IP addr $ips{$curious_about}\n";
}
else {
print "No IP addr information for $curious_about\n";
}
}
####
tdat_cur contains:
michael
joe
renee
####
tdat_ips contains:
rose 10.100.100.12
michael 10.100.100.13
renee 10.100.100.14
nizar 10.100.100.15