in reply to extract problem
Note the use of the list context in declaring $tot - this finds you the FIRST instance of "Total".my ($tot)= grep /Total/, qx[sysutil]; print $tot; # Should already include "\n"
Efficiency experts (Nit pickers) may want an early exit out of the "grep", but I think , in this, presumably reletively infrequent usage, simplicity overrides.
You can parse $tot for the numeric values with a regex or split, if necessary.
Update:I just noticed that ikegami(++) beat me to it in his second, third and fourth examples. His code is tighter, ensuring that "Total" is the first word on the line.
"Man cannot live by bread alone...
He'd better have some goat cheese and wine to go with it!"
|
|---|