foreach my $d(readdir(PROC)){ next if $d !~ /^[0-9]+$/; my $procdir = "/proc/$d"; open($filehandles{$procdir}, "<", $procdir/status") || warn "can't open status with$procdir"; } foreach my $fh ( keys %filehandles ) { while(<$fh>){ @a = split(/\s+/, $_) if /Uid/; $temp[0] = $a[1]; @b = split(/\s+/, $_) if /VmSize/; $temp[1] = $b[1]; } close $fh; }