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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T17:44:15+00:00 2026-06-03T17:44:15+00:00

A newborn Perl developer here. I’ve been wracking my brain and searching all over

  • 0

A newborn Perl developer here. I’ve been wracking my brain and searching all over online trying to figure this out… exasperated, I am come to you seeking clarity.

I have the following code (only relevant parts left in) as rest is working):

my @arrMissingTids;
@arrMissingTids = %hshTids;

my $missingtid;
foreach $missingtid (@arrMissingTids) {
    print "$missingtid\n";
}

This works well, returning the values I want to be in the array:

500000246,500000235,500000185,500000237,500000227,500000252

However, when I pass this to a subroutine and include it in a variable name, it does not provide the list as written above, but rather just the number 1. Code for that is below:

myqry(@arrMissingTids);

sub myqry($) {

    my $missingtids = @_;

    $sql = "select 
        i.tid i_tid, i.name i_name
        from 
        instrument i
        where i.tid in ($missingtids)";

    print "$sql/n";
}

Print $sql returns the following:

Select i.tid i_tid, i.name i_name from instrument i where i.tid in (1)

When I want it to return the following:

Select i.tid i_tid, i.name i_name from instrument i where i.tid in (500000246,500000235,500000185,500000237,500000227,500000252)

Thanks in advance for any pointers in the right direction!

  • 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-06-03T17:44:17+00:00Added an answer on June 3, 2026 at 5:44 pm

    The problem is right here:

    my $missingtids = @_;
    

    You’re calling the array @_ in scalar context. That means that you’re assigning to $missingtids the number of elements in @_. One way to work around this would be to pass an array reference:

    sub myqry {
    
        my $missingtids_ref = shift;
        my @missingtids=@$missingtids_ref;
    
        $sql = "select 
            i.tid i_tid, i.name i_name
            from 
            instrument i
            where i.tid in (" . join(",",@missingtids) . ")";
    
        print "$sql/n";
    }
    

    For more information, take a look at perldoc perlref and perldoc perldata.

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

Sidebar

Related Questions

this is really simple but I am sleep deprived (newborn baby) and can't seem
I'm a newborn developer for iPad, I finally finished an app and I want
I have a task - add round corners to HtmlPanelGrid. Now I am trying
I am a newborn programmer who is currently looking into the Insert, Update and
I'm a new-born programmer so I am NOT experienced, nor do I understand all
I have two tables: AgeMilestones //Represents available timespans Id int Description varchar //(newborn, 1
Assuming i want to open another activity from my current activity and i want
I have an activity A that launches B with an Intent. (B is a
Consider I have the following classes: class User { [Key] public Guid Id {get;
I have an entry I need to accept a person's date of birth in.

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.