in reply to process table
Because you have two CPUs, and a hash holds one item. So the last one read wins for each CPU. Try this to get a hash of arrays (HoA):
push @{$prochash{$cpu}}, { 'pid' => $pid, 'time' => $time, 'user' => $user, 'args' => $args, };
Or if you want a hash of hashes (HoH), use the first level for the CPU and the second for the PID:
$prochash{$cpu}{$pid} = { 'pid' => $pid, 'time' => $time, 'user' => $user, 'args' => $args, };
There are other ways to do it, too. You may want to review perldoc perldsc
Update: Changed language a little to clarify.
...roboticus
When your only tool is a hammer, all problems look like your thumb.
|
|---|