On Wed, Apr 13, 2016 at 7:13 PM, Ken Slater <kenslate...@gmail.com> wrote:
>
> On Wed, Apr 13, 2016 at 9:29 PM, Kenneth Wolcott <kennethwolc...@gmail.com>
> wrote:
>>
>> Hi;
>>
>>   I have the following output from Data::Dumper and I want to extract
>> the first string that the "Id" name points to.
>>
>> $VAR1 = [
>>           bless( {
>>                    'Id' => [
>>                            '01tC0000003udXAIAY',
>>                            '01tC0000003udXAIAY'
>>                          ],
>>                    'type' => 'Product2'
>>                  }, 'sObject' )
>>         ];
>>
>>   So if the data structure is contained in a Perl variable called
>> $data, then I think that this is a reference to a hash.
>>
>>   So I need to do something like "@{$data}" to get to the hash.
>>
>>   But I want the "Id" element of the hash so I want something like
>> @{$data}->{'Id'}
>>
>>   But that's the array, so what about ${@{$data}->{'Id'}}[0]
>>
>>   But that isn't right either.
>>
>>   I'm either getting an undefined reference to a hash error or not a
>> scalar reference error.
>>
>> Thanks,
>> Ken Wolcott
>>>
>>>
>
> It appears that you have a reference to an array of 'sObject'  blessed
> objects.
> You can probably get the info you want through one of these methods:
>
> print ${$data}[0]->{id}[0];
> print $data->[0]->{id}[0];
>
> Or, you could use the class methods for the sObject package (assuming you
> have that).
>
> hth.
>  Ken

  Thanks so much for the pointers.

  Unfortunately both ideas return with "Use of uninitialized value in print".

  I'll continue to look at them to try to figure out why.

Thanks,
Ken Wolcott

-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to