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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T10:46:48+00:00 2026-05-23T10:46:48+00:00

All right, I’ll try to explain what I’ve done so far. I’m using a

  • 0

All right, I’ll try to explain what I’ve done so far. I’m using a Parellel::ForkManager to grab data from an array of URLs, which is then stored in variables (value1, value2, value3).

I then collect the data from all of those processes, and display the data with $pm->run_on_finish.

#...
my $pm = new Parallel::ForkManager(10);

$pm->run_on_finish (
    sub {
        my @info = @{$data_structure_reference};

        print $info[0];
        print $info[1];
        print $info[2];
    }
);

for my $var (@urls) {

    $pm->start and next;
    #...
    @returned = &something($var);
    #...
    $pm->finish(0, \@returned);

}

sub something {

    #... getting data from each URL and storing it in variables

    my @array = (
        $value1,
        $value2,
        $value3
    );
    return @array;
}

Now, what I want to do, is to pass an array, @value4, as well, and then only display that data if there is something in the array. So, I want it to look like this:

sub something {

    #... getting data from each URL and storing it in variables

    my @array = (
        $value1,
        $value2,
        $value3,
        @value4
    );
    return @array;
}

And then I want it to print that array, only if there is something in it.

Unfortunately, I’m not entirely sure how to go about doing that.

  • 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-23T10:46:49+00:00Added an answer on May 23, 2026 at 10:46 am

    I assume that what you are asking is how to return an array along with the three scalars returned from the something() sub, and print it?

    I also assume that those three scalars are what’s referred to as being in @info.

    The simplest way seems to me to be to simply tack them to the end of the array you return, use the three first values, and if there’s anything left, print that too.

    $pm->run_on_finish (
        sub {
            my @info = @{$data_structure_reference};
    
            print splice @info, 0, 3;
            print @info if (@info);
        }
    );
    
    sub something {
        return (
                $value1,
                $value2,
                $value3,
                @value4
            );
    }
    

    As you’ll notice, you do not need to fill a dummy array for the return value, simply return values inside the parens. You do not need to dereference the array, since you can use the @info array straight up if you splice off the first three values.

    I like it simple. If it works.

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

Sidebar

Related Questions

I'm using the OnIdle-event for some simple animations, and it works all right. The
Right now all I am using to calculate the size are the files in
All right, you guys were very helpful with my last question, so I'll try
All right, after having worked through Cocoa Dev Central's Build a Core Data Application
I use AutoBean to code/decode data to JSON and that was all right in
All right, so I am being passed an array of checked items represented by
I try to send values to the GLSL, int is just all right, but
All right, let's say I have the following plot. df = data.frame(date=c(rep(2008:2013, by=1)), value=c(303,407,538,696,881,1094))
All right all, So I've got a UITableView that is inited in applicationDidFinishLaunching like
you all know: right click -> zoom in or out in flash file, well,

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.