Folks,

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 output:

real    0.03
user    0.45
sys     1.34

# we only want the timex out put, not the command output
# so we enclose the timex and the command in ()'s and then
# redirect STDERRR to STDOUT to capture the timex return
# values.
# timex is a POS, the darn thing spews on STDERR, causing me headaches ;)

@timex = qx((timex ps -ef > /dev/null) 2>&1 );
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;
        # pus those variables into the hash storing each key/value pair
        push( @{$hash{$key}}, $value);
}


Ron

Reply via email to