Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re: Re: Re: Returning a list from a sub

by seattlejohn (Deacon)
on Jul 24, 2002 at 05:28 UTC ( [id://184707]=note: print w/replies, xml ) Need Help??


in reply to Re: Re: Returning a list from a sub
in thread Returning a list from a sub

It looks suspiciously like you have a scoping issue with @List. What is probably happening is that you have (either explicitly or implicitly) created a *global* variable called @List, rather than a local variable within each subroutine. I would suggest adding my @List; to the beginning of your TSM_Enquire and Process_Columns subs, which will give them each a private copy of the list that is empty each time the sub is first executed. For more details, you can check out the sections on scoping in perldoc perlsub.

Also, you might also want to use strict; at the beginning of your program to help catch errors like this in the future.

If that doesn't solve the problem, it might be worth trying some simple debugging tricks, like adding warn statements on subroutine entry and exit and when you are manipulating @List or other variables that are central to what your code is trying to accomplish.

  • Comment on Re: Re: Re: Returning a list from a sub

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others having a coffee break in the Monastery: (2)
As of 2024-04-25 20:09 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found