Beefy Boxes and Bandwidth Generously Provided by pair Networks
Come for the quick hacks, stay for the epiphanies.
 
PerlMonks  

Re: Returning data from a sub routine in a module.

by toolic (Bishop)
on Apr 19, 2016 at 19:39 UTC ( [id://1160920]=note: print w/replies, xml ) Need Help??


in reply to Returning data from a sub routine in a module.

You didn't show how you assigned anything to @data in your .pm file. When I fill @data, I get the expected output:
sub results { my @data = 1..5; my $results = \@data; return $results; }

Replies are listed 'Best First'.
Re^2: Returning data from a sub routine in a module.
by Anonymous Monk on Apr 19, 2016 at 19:45 UTC
    I didn't because I just want to make sure I am calling the sub in the module from the perl script the correct way. I my code if I do a print Dump inside of the module's sub I get data but as I asked, from the Perl file it returns an empty value. So you are saying since you added data the code I posted is correct?

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others exploiting the Monastery: (2)
As of 2024-04-26 05:44 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found