Just read your update. foreach? while? up to you, both could work here. One approach to your query:
#!/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
As you can see I'm a foreach kinda guy. That data is very simplified and you'll probably need to handle a slightly more complex match and split.
Be Appropriate && Follow Your Curiosity