>>>>> "AG" == Agnello George <agnello.dso...@gmail.com> writes:


  AG> $selet_domU_data   = [ { 'windows2 ' => { 'lvm' => ' windows2 8GB ram 50 
GB
  AG> HDD',
  AG>                                                           'cpu' => 'na',
  AG>                                                           'ip' => '
  AG> 171.16.1.10',
  AG>                                          'application' => ' win2k8
  AG> ,sql,iis',
  AG>                                                  'hosting' => '',
  AG>                                      'assigned_to' => ali',
  AG>                                              rdom0id' => '11',
  AG>                                    'server_name' => 'windows2 ',
  AG>                                                   'ram' => ' na' } } ];

what are you doing to make that so unreadable? seriously. you claim to
be calling Data::Dumper but the formatting is all over the place. that
is unreadable so we can't check out what you want or have.

  AG> $select_all_website  = [ { '6' => { 'website_name' => 'website.com',
  AG> 'website_id' => '6' },
  AG>                            '3' => { 'website_name' => 'life.com',
  AG> 'website_id' => '3' },
  AG>                            '7' => { 'website_name' => 'writes.com',
  AG> 'website_id' => '7' } } ];

maybe you have set the format value of dumper to something else? or your
emailer is destroying the format with line wrapping abuse? but please
learn how to show clean data trees here (and elsewhere). it will make
your understand of the data infinitely easier.


  AG>    foreach my $ke2 (keys  %$select_all_website ) {
  AG> push (@{$selet_domU_data->{$ke1}{'all_web'}}, {$ke2  =>
  AG> $select_all_website->{$ke2}}   );
  AG>    }
  AG> }

reformatted for humans to read. white space added, proper indenting,
newlines where needed.

        foreach my $ke2 ( keys %{$select_all_website} ) {
                push( @{ $selet_domU_data->{$ke1}{'all_web'} },
                        {
                                $ke2  => AG> $select_all_website->{$ke2}
                        }
                ) ;
        }

  AG> this is what i wanted , isn't this called pushing a hash into
  AG> another hash .

as i said in another post, you can't push onto a hash. you can push into
an array reference that is IN the hash. with the reformatted code you
can see the push (which ONLY take an array for its first arg) is getting
a hash ref for its data. the parent hash has an array ref there (or will
after the push due to autovivification).

but please stop calling that a push into a hash as it isn't one.

uri

-- 
Uri Guttman  ------  u...@stemsystems.com  --------  http://www.sysarch.com --
-----  Perl Code Review , Architecture, Development, Training, Support ------
---------  Gourmet Hot Cocoa Mix  ----  http://bestfriendscocoa.com ---------

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