#!/usr/bin/perl -w use strict; use Data::Dumper; my @files = map { 'passwd.server' . $_ } 1 .. 9; my %data; for my $file (@files) { open (PASSWD, $file) or die "Unable to open $file : $!"; while () { chomp; my @field = split /:/ , $_; $data{$file}{$field[0]} = \@field } } # Code to manipulate and identify conflicts in %data goes here print Dumper(\%data);