#!/usr/bin/perl -w use strict; # Always use strict; open(PASSWD, '/etc/passwd') || die "Could not open /etc/passwd: $!\n"; my %where; while () { my @linesplit = split /:/; # No need to use $line, # @array1 or @array3 @where{$linesplit[0]} = $linesplit[3]; } close (PASSWD) || die "Error closing file: $!\n"; #Close an opened file! foreach my $i (grep {$where{$_} > 1000} keys %where) { system ("find '/home/u1' -user $i -print > $i"); }