foreach $file(@list_of_files) { open FILE, "$dir/$$file" || die "Can't open $dir/$file: $!\n"; while ($lines = ) { chomp $lines; next if ($lines =~ /unknown|shutdown/); ($name, $ranks, $serial_numbers) = split(' ',$line); push @{$HoL{$name}}, $ranks; } }