Hi Agnello,

On Tuesday 07 Jun 2011 11:04:58 Agnello George wrote:
> On Tue, Jun 7, 2011 at 1:13 PM, marcos rebelo <ole...@gmail.com> wrote:
> > I don't understand what you are trying to do
> 
> Ok , i got 2 hashes
> 
> $hashref1   = [ { 'windows2 ' => { 'lvm' => ' windows2 8GB ram 50 GB HDD',
> 'cpu' => 'na', 'ip' => ' 171.16.1.10', 'application' => ' win2k8 ,sql,iis',
> 'hosting' => '', 'assigned_to' => ali', 'rdom0id' => '11', 'server_name' =>
> 'windows2 ', 'ram' => ' na' } } ];
> 
> $hashref2 = [ { '6' => { 'website_name' => 'website.com', 'website_id' =>
> '6' }, '3' => { 'website_name' => 'life.com', 'website_id' => '3' }, '7' =>
> { 'website_name' => 'writes.com', 'website_id' => '7' } } ];
> 
> 
> 
> i need to push $hashref2  into hashref1
> 
> 
> need to get some thing like
> 
> $hashref1   = [ { 'windows2 ' => { 'lvm' => ' windows2 8GB ram 50 GB HDD',
> 'cpu' => 'na', 'ip' => ' 171.16.1.10', 'application' => ' win2k8 ,sql,iis',
> 'hosting' => '', 'assigned_to' => ali', 'rdom0id' => '11', 'server_name' =>
> 'windows2 ', 'ram' => ' na' }, all_websites =>  { '6' => { 'website_name'
> => 'website.com', 'website_id' => '6' }, '3' => { 'website_name' =>
> 'life.com', 'website_id' => '3' }, '7' => { 'website_name' =>
> 'writes.com', 'website_id' => '7' } }  } ];

You don't push a hashref into another hashref. And $hashref1 is clearly an 
array reference (which makes its name confusing). Please go over the relevant 
resources about references and nested data structures in Perl here:

http://perl-begin.org/topics/references/

After that you can use "perl -d" to do things interactively and debug your 
program:

http://perl-begin.org/topics/debugging/

Unit tests may also be a good idea:

http://perl-begin.org/uses/qa/

Regards,

        Shlomi Fish

-- 
-----------------------------------------------------------------
Shlomi Fish       http://www.shlomifish.org/
Interview with Ben Collins-Sussman - http://shlom.in/sussman

I promised, I forgot, I did not keep my promise — just shoot me, and get on
with it!

Please reply to list if it's a mailing list post - http://shlom.in/reply .

--
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