in reply to Running a command in Perl

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