<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Get cloud.uuid optionvalue from extra config without iterating through the array? in vSphere SDK for Perl Discussions</title>
    <link>https://communities.vmware.com/t5/vSphere-SDK-for-Perl-Discussions/Get-cloud-uuid-optionvalue-from-extra-config-without-iterating/m-p/1292779#M1278</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I need to get the cloud.uuid (or any other optionValue for that matter) from the extraConfig data object.&amp;nbsp; Is there a way to get to the value of a specific key without having to iterating through the array? As this is not a hash, attempt at getting to the value with this fails miserably:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;$extra-&amp;gt;{'could.uuid'}...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here is an iteration approach that works.&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;my $extra = $vm-&amp;gt;config-&amp;gt;extraConfig;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; foreach (@$extra) {&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; print $_-&amp;gt;value if ($_-&amp;gt;key =~ /cloud.uuid/);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 26 Sep 2013 23:17:06 GMT</pubDate>
    <dc:creator>MR-Z</dc:creator>
    <dc:date>2013-09-26T23:17:06Z</dc:date>
    <item>
      <title>Get cloud.uuid optionvalue from extra config without iterating through the array?</title>
      <link>https://communities.vmware.com/t5/vSphere-SDK-for-Perl-Discussions/Get-cloud-uuid-optionvalue-from-extra-config-without-iterating/m-p/1292779#M1278</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I need to get the cloud.uuid (or any other optionValue for that matter) from the extraConfig data object.&amp;nbsp; Is there a way to get to the value of a specific key without having to iterating through the array? As this is not a hash, attempt at getting to the value with this fails miserably:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;$extra-&amp;gt;{'could.uuid'}...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here is an iteration approach that works.&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;my $extra = $vm-&amp;gt;config-&amp;gt;extraConfig;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; foreach (@$extra) {&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; print $_-&amp;gt;value if ($_-&amp;gt;key =~ /cloud.uuid/);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 26 Sep 2013 23:17:06 GMT</pubDate>
      <guid>https://communities.vmware.com/t5/vSphere-SDK-for-Perl-Discussions/Get-cloud-uuid-optionvalue-from-extra-config-without-iterating/m-p/1292779#M1278</guid>
      <dc:creator>MR-Z</dc:creator>
      <dc:date>2013-09-26T23:17:06Z</dc:date>
    </item>
    <item>
      <title>Re: Get cloud.uuid optionvalue from extra config without iterating through the array?</title>
      <link>https://communities.vmware.com/t5/vSphere-SDK-for-Perl-Discussions/Get-cloud-uuid-optionvalue-from-extra-config-without-iterating/m-p/1292780#M1279</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Unfortunately it's an array, so you'll have to iterate.&amp;nbsp; If you wanted to, you could convert it to a hash.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You could use 'grep' as well to get a one liner.&amp;nbsp; It won't be such a large array in any event that there is any real dramatic speed increase between a hash and an array.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 04 Oct 2013 15:15:47 GMT</pubDate>
      <guid>https://communities.vmware.com/t5/vSphere-SDK-for-Perl-Discussions/Get-cloud-uuid-optionvalue-from-extra-config-without-iterating/m-p/1292780#M1279</guid>
      <dc:creator>stumpr</dc:creator>
      <dc:date>2013-10-04T15:15:47Z</dc:date>
    </item>
    <item>
      <title>Re: Get cloud.uuid optionvalue from extra config without iterating through the array?</title>
      <link>https://communities.vmware.com/t5/vSphere-SDK-for-Perl-Discussions/Get-cloud-uuid-optionvalue-from-extra-config-without-iterating/m-p/1292781#M1280</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks stumpr. Understood. Just wanted to see if anything magic out there...&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 04 Oct 2013 17:09:20 GMT</pubDate>
      <guid>https://communities.vmware.com/t5/vSphere-SDK-for-Perl-Discussions/Get-cloud-uuid-optionvalue-from-extra-config-without-iterating/m-p/1292781#M1280</guid>
      <dc:creator>MR-Z</dc:creator>
      <dc:date>2013-10-04T17:09:20Z</dc:date>
    </item>
    <item>
      <title>Re: Get cloud.uuid optionvalue from extra config without iterating through the array?</title>
      <link>https://communities.vmware.com/t5/vSphere-SDK-for-Perl-Discussions/Get-cloud-uuid-optionvalue-from-extra-config-without-iterating/m-p/1292782#M1281</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You can use config.extraConfig["cloud.uuid"] as the property name in PropertySpec pathset and that will retrieve only the cloud.uuid extraconfig.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 15 Oct 2013 07:17:37 GMT</pubDate>
      <guid>https://communities.vmware.com/t5/vSphere-SDK-for-Perl-Discussions/Get-cloud-uuid-optionvalue-from-extra-config-without-iterating/m-p/1292782#M1281</guid>
      <dc:creator>litty123</dc:creator>
      <dc:date>2013-10-15T07:17:37Z</dc:date>
    </item>
    <item>
      <title>Re: Get cloud.uuid optionvalue from extra config without iterating through the array?</title>
      <link>https://communities.vmware.com/t5/vSphere-SDK-for-Perl-Discussions/Get-cloud-uuid-optionvalue-from-extra-config-without-iterating/m-p/1292783#M1282</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Within perl you can do the following to find an element in an array:&lt;/P&gt;&lt;BLOCKQUOTE&gt;
&lt;P&gt;&lt;SPAN style="color: #000000; font-family: monospace; font-size: medium;"&gt;if (grep {$_ eq $element} @TheArray) { print "Element '$element' found!\n" ; }&lt;/SPAN&gt;&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;&lt;P&gt;(Original article here &lt;A href="http://www.perlmonks.org/?node_id=2482" title="http://www.perlmonks.org/?node_id=2482"&gt;How to find out if X is an element in an array?&lt;/A&gt; )&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can adapt this to your scenario by doing:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE&gt;
&lt;P&gt;&lt;SPAN style="color: #000000; font-family: monospace; font-size: medium;"&gt;&lt;SPAN style="color: #666666; font-family: proxima-nova, Arial, sans-serif; font-size: 14px;"&gt;print $_-&amp;gt;value&lt;/SPAN&gt; if (grep {$_-&amp;gt;&lt;SPAN style="color: #666666; font-family: proxima-nova, Arial, sans-serif; font-size: 14px;"&gt;key =~ /cloud.uuid/} @$&lt;SPAN style="color: #666666; font-family: proxima-nova, Arial, sans-serif; font-size: 14px;"&gt;extra&lt;/SPAN&gt;&lt;/SPAN&gt;);&lt;/SPAN&gt;&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 16 Oct 2013 05:02:39 GMT</pubDate>
      <guid>https://communities.vmware.com/t5/vSphere-SDK-for-Perl-Discussions/Get-cloud-uuid-optionvalue-from-extra-config-without-iterating/m-p/1292783#M1282</guid>
      <dc:creator>probo</dc:creator>
      <dc:date>2013-10-16T05:02:39Z</dc:date>
    </item>
  </channel>
</rss>

