Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things

Re: sub will not return data correctly (the way i want it to!!)

by aaron_baugher (Curate)
on Jun 18, 2015 at 00:24 UTC ( #1130909=note: print w/replies, xml ) Need Help??

in reply to sub will not return data correctly (the way i want it to!!)

When you call your second subroutine, it's going to start through the first loop of your for(), do the four reads, then return. It's never going to do the other 3 loops.

If you want to do the loop four times and then return a list of all the results, you can do that. Create an array before your for() loop starts, then replace your return with a push to that array:

push @results, $foo1, $foo2, $foo3, $foo4;

Then after the for() loop is finished, return @results.

Aaron B.
Available for small or large Perl jobs and *nix system administration; see my home node.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1130909]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (4)
As of 2020-06-07 10:52 GMT
Find Nodes?
    Voting Booth?
    Do you really want to know if there is extraterrestrial life?

    Results (42 votes). Check out past polls.