You didn't mention specifically what you tried, and in what way it fails, so it's hard to diagnose what you're doing wrong. Does this work for you?
foreach(`ps aux | grep java`){ if (/-Xmx((\d+)[gG])/) { $mem += $2 } } print "total memory reserved by Java processes: ${mem}G\n"
Dave
In reply to Re: Running a command in Perl
by davido
in thread Running a command in Perl
by thebeaniemonster
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |