#!/usr/bin/perl use strict; use warnings; use Data::Dumper; my @all_profile; my %homes_by_names; while (){ chomp; my @f = split ',',$_; my %profile; $profile{ NAME } = $f[0];#$row->{'name'}; $profile{ ADDRESS } = $f[1];#$row->{'address'}; $profile{ HOME } = $f[2];#$row->{'home'}; # I will need to count the how many homes here ++$homes_by_names{ $profile{ NAME } }; push @all_profile, \%profile; } for (@all_profile){ $_->{'HOME COUNT'} = $homes_by_names{ $_->{ NAME } }; } print Dumper \@all_profile; __DATA__ John Doe, Main Street, House 1 John Doe, Main Street, House 1 John Doe, Main Street, House 1 Mary Lou, Central Street, House 1 Mary Lou, Central Street, House 1 Mary Lou, Central Street, House 1 Mary Lou, Central Street, House 1 Jane B,. Squere Rd., House 1 Maria D., Pat street, House B Maria D., Pat street, House B