bobssite.autossl.net www.bobssite.com bobssite.dealer.net billssite.autossl.net www.billssite.com www.billsothersite.com bobssite.dealer.net #### #!/usr/bin/perl use strict; use warnings; my %host_contents; my $host_id; while (<>) { chomp; if ($_ =~ /host id="(.*?)"/) { $host_id = $1; } if ($_ =~ m{(www.*?)}) { push @{ $host_contents{$host_id} }, $1; } }