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 1108659
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T02:07:09+00:00 2026-05-17T02:07:09+00:00

I seem to recall (though can’t find any reference now) to one being able

  • 0

I seem to recall (though can’t find any reference now) to one being able to do something akin to

my @a = ("foo","bar");
my ($item1, $item2) = @a;

The above does not do what I want it to (obviously) but I seem to recall that there is some way to do this, where it loads the items associated with the order of the scalars in the parenthesized list.

For that matter I thought that’s how the args array is passed into subroutines, as in…

sub method{
  my ($arg1, $arg2) = @_;
}

Maybe I’m just going out of my mind, but I thought this was possible.

[EDIT]

Ah…so based on the first answer I realize that the reason it’s not working is that I’m using a two dimensional array. So, in my code it actually looks like this:

foreach(@twoDimenArray){
    my ($item1, $item2, $item3) = $_; #$_ is an array
}

It must be the $ syntax that’s screwing it up but I’ve tried ($_) and @($_) and @$_ and none of those work.

  • 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-17T02:07:09+00:00Added an answer on May 17, 2026 at 2:07 am

    Try using @{$_}:

    foreach (@twoDimenArray) {
        my ($item1, $item2, $item3) = @{$_};    # $_ is an array
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I seem to recall being able to configure asp.net ajax using attributes on the
I seem to recall something about avoiding the Immediate If operator ( ?: )
I seem to recall Lua has something similar to Ruby's method_missing. Or am I
I seem to recall reading about a way to 'reduce' the size of template
I seem to recall hearing at some point (I believe it was MIX09) that
I could very will be imagining things, but I seem to recall in Java
I seem to recall that there is an HTML tag that escapes absolutely everything
My memory is fuzzy but I seem to recall that Windows Vista introduced an
I don't remember whether I was dreaming or not but I seem to recall
Are there any major differences in performance between http and https? I seem 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.