Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3310546
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T21:46:22+00:00 2026-05-17T21:46:22+00:00

I have 3 dimensional hash and a 2 dimensional hash, and I want to

  • 0

I have 3 dimensional hash and a 2 dimensional hash, and I want to merge the 2 dimensional hash with one of the inner hashes of the 3 dimensional hash, something like this, which is similar to what I do to merge a pair of 2d hashes:

my %3dhash;
my %2dhash;
my $key = "some string";
%3dhash{$key} = ($3dhash{$key}, %2dhash);

But when I tried that it didn’t work. What should I be doing?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-17T21:46:23+00:00Added an answer on May 17, 2026 at 9:46 pm

    Try the following:

    my %hash3d;
    my %hash2d;
    ....
    my $key = "some string";
    $hash3d{$key} = { %{ $hash3d{$key} }, %hash2d };
    

    Variables in Perl can’t start with a number, so I renamed the variables. The %{ ... } around the existing hash expands it as a list. This list flattens with the list from %hash2d. The { ... } around that list is the anonymous hash reference constructor, which creates a new hash reference that is then stored in $hash3d{$key}

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a multi-dimensional array, which basically consists of one sub-array for each year.
I have a multi dimensional array, like this: array('name' => array('title'=>'Title','date'=>'Created')) I store it
I have a two dimensional array like this $FrstArr = Array( [0]= array( [0]=>101,
i have an multi-dimensional array which looks like $a[] = array('id' => '1', 'city'
I have three one-dimensional arrays. The task is to store the numbers which exist
I have a multi-dimensional array similar to the example below that I want to
I have a one dimensional NumPy array: a = numpy.array([2,3,3]) I would like to
I have a one-dimensional array of strings in JavaScript that I'd like to turn
I have a three dimensional array which I want to fill in with values
I have a one dimensional vector of data in R and I want to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.