in reply to Return array not passed to sub call

You should reply to a post as opposed to updating your original post with the reply - I only saw your response by accident.

While it's not incorrect syntax, you should call your subroutines without a leading ampersand (&) - see perlsub for details.

The warnings pragma is lexically scoped. Perhaps you have it hidden in a block somewhere - you haven't shown it so there's no way to tell if you've used the correct syntax. The documentation will tell you. You haven't shown use of the strict pragma either.

You're using two @reports arrays. Is that causing you some confusion? Is that what you intended? The first one might be global but you haven't shown enough code for me to tell.

You could test the values of variables with a simple print statement to see if what you think you're passing around is actually happening.

You need to show your output. It doesn't matter if it's going to the screen, saved in a log file or reported in some other fashion - you need to include it with your problem description.

Your code would be a lot easier to read if you used indentation - see perlstyle for some pointers in this regard.

Have you read How do I post a question effectively? There's a link to this page about 5 lines under the Preview button. It's there whenever you want to post a node. Please familiarise yourself with its contents.

-- Ken

Replies are listed 'Best First'.
Re^2: Return array not passed to sub call
by umasuresh (Hermit) on Nov 19, 2010 at 17:44 UTC
Re^2: Return array not passed to sub call
by begood321 (Novice) on Nov 19, 2010 at 15:41 UTC

    I just copied relevant code where I have issues. I am using correct syntax because I have no errors using -wc along with use : warnings, diagnostics, strict in my code. I'm trying to pass the same value from variable reports1 to reports2.

    This is output I get:

    Fri Nov 19 00:29:35 2010 : INFO : expiration_report.ipl : reports1: /iwmnt/default/main/internet/WORKAREA/WCM/expiration_reports/ts_groups/corp_gov/corp_gov_invalid_expiry_date.csv, total: 1

    Fri Nov 19 00:29:35 2010 : INFO : expiration_report.ipl : reports2:

    Fri Nov 19 00:29:35 2010 : INFO : expiration_report.ipl : Reports Created on webcmsib

      Hi Ken,

      I'm using 1 @reports array. I simply want to pass array from sub return to sub call so I can access array values from other parts of code below sub call but above sub return. Hope you understand what I'm trying to achieve. Thanks for help.

        When you originally wrote a reply to me by updating your original post, I wrote:

        "You should reply to a post as opposed to updating your original post with the reply - I only saw your response by accident."

        Now you have replied to your own post. It appears to be addressed to me and, again, I've only found it by accident.

        Please show your new code where you are now only "using 1 @reports array". I'm not sure how you expect anyone to know if you renamed one of them, removed one of them, or did something else.

        I will respond further if you follow the guidelines in How do I post a question effectively?.

        -- Ken