use "xmllint" with XPath 

http://sourceforge.net/mailarchive/forum.php?forum_id=26200&max_rows=25&style=nested&viewmonth=200406

use "xmllint" with an appropriate XPath to find the XML element you want, such as:

@ver = qx(echo "cat
//key[text()="ProductVersion"]/following-sibling::*/text()" | xmllint
--shell /System/Library/CoreServices/SystemVersion.plist);
chomp $ver[1];
return $ver[1];

That way, if the ordering (or number) of keys in the SystemVersion.plist file changes at some point, the command doesn"t break and you can still find the data you want to get out of the file. — It"s not much shorter nor simpler… but it should be more robust.