if ($line=~ /(\d{1,3},\d{3,3},\d\d\d K)/){ # e.g. 3,373,560 K $processname=" $`"; # matches before string $memory = $& ; # $& matches the string #### print "$memory --- $processname
\n"; ##
## push(@allprocesses, $memory => " - $processname
",); $memory = ""; # empty variable $processname = ""; # empty variable print "Unsorted Array:
@allprocesses \n" ; ##
## %memhash=@allprocesses; $anz=keys(%memhash); print "Pair of Hashes: $anz
\n"; foreach $key ( sort {$b <=> $a} values %memhash){ $help1 = " $keys$memhash{$keys}"; print "Memory: $key Name: $help1
\n"; ##
## @sorted = sort({$b<=>$a}values(%memhash)); for ($i=0; $i<=$#sorted; $i++) { my $paar = $sorted[$i]; print "$paar = $memhash{$paar}
" ; } print "\n" ;