#!/usr/bin/perl -w use strict; my $hostfile = "/etc/hosts"; my %hosts = (); open FILE, "<", "$hostfile" || die "Cannot open $hostfile $!"; while () { chomp; my ($key, $value) = split (" ", $_); $hosts{$key} = $hosts{$value}; } close FILE;