http://qs321.pair.com?node_id=609146

mbayer has asked for the wisdom of the Perl Monks concerning the following question:

I am attempting to grep the total system memory of a Solaris box with the (prtconf | grep Memory) command, and then user Reg expressions to gather the RAM amount but I received the error: Could not open pipe for prtconf. This should work, Any help would be appreciated.
#!/usr/local/bin/perl -w use FileHandle; $memcmd=`/usr/sbin/prtconf | grep Memory`; $tmem = 0; $tmem_idle = new FileHandle ("$memcmd") || die "Could not open pipe fo +r prtconf: $!\n"; while (<$tmem_idle>) { if ( $_ =~ m/^.*\s+(\d+)\s+\d+$/ ) { $tmem = $1; } } close $tmem_idle; $tmem_busy = $tmem; # Just print the info! print "The total Memory amount is: $tmem_busy"; exit 0;
O.K. -- syntax kills me again. Many thanks for the help.