> am I doing this right? I am looking to take the output from timex,
toss it
> into a hash keyed on the first field (real, user,sys)

> @timex = qx((timex ps -ef > /dev/null) 2>&1 );

The inner brackets are interpreted by the shell.
Can't help you there. My guess is you know
what you are doing in regards to the shell.

> foreach (@timex) {
> # timex puts some stupid spaces on its output
> # se we need to weed them out
> s/^\s+//
> # lets split the data up into 2 segments
> # and store them in some variables
> ($key, $value) = split;

All seems fine.

> # pus those variables into the hash storing each key/value pair
> push( @{$hash{$key}}, $value);

I think you want:

    $hash{$key} = $value;

What you coded pushes the $value onto an array
pointed to by $hash{$key}. You could get the values
back out with $hash{$key}[0] of course, but it's
pretty clear that's not what you meant.

To

Reply via email to