"CATHY GEAR (TRUST HQ)" wrote:

> Yes please post the final working solution!  This is always helpful.
>
> Thanks
>
> Cathy
>

The best solution was John's offer
while (<INPUTDATA>) {
        if ((/NPROC/ .. /^Total/) && /\d/) {
                my ($user, $mem, $cpu) = (split)[1, 4, 6];
                print "user = $user, mem = $mem, cpu = $cpu\n";
        }
}

The fix to mine was, I think (OP must confirm this)
while (<INPUTDATA>) {
        chomp;
        s/^\s+//;
        next if ((1 .. /^NPROC/) || m/^$/);
       # The conditions have been swapped here
       # Explanation for this is one of my earlier mails
        unless (/^Total/) {
                # Assumes the line to stop searching for input starts with Total
                my ($user, $mem, $cpu) = (split (/\s+/))[1, 4, 6];
                print "user = $user, mem = $mem, cpu = $cpu\n";
        }
}


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to