http://qs321.pair.com?node_id=267713


in reply to "Useless use of private variable in void context"

I don't get that error, so I'd guess it's somewhere else in your code. Also you might consider using my $generated_password = GeneratePassword();, that last part is just my opinion as I have had trouble with &.

"Pain is weakness leaving the body, I find myself in pain everyday" -me

Replies are listed 'Best First'.
Re: Re: "Useless use of private variable in void context"
by Seumas (Curate) on Jun 20, 2003 at 21:35 UTC

    I don't seem to get the same error if I run it in a test script by itself, either. But if I remove the line in question, I do get an error - just later in the script (the next chunk of code, which is an eval{} but in which I can find no problem either).

    As for the ampersand - I have been conflicted over this. At one point I had read that there was a difference between calling a sub naked and calling it with an ampersand prefixed to it. I believe that it stated you should use an ampersand if you expected something to be returned (or to make the sub return to its calling point no matter what?). But I have since been told by a couple of people that the rule of the ampersand is obsolete (or more accurately, was documented but then never implemented).

    I do it out of habit now, though I'm trying to break it!

    I guess I just needed some people smarter than myself to assure me that the snippet of code and how it was being accessed wasn't really the problem. (I assumed it was not, since I coudl run it by itself). Now I know that focusing on that bit is a waste of time and can look toward the rest of the sub for the culprit. It's a huge sub, but it's syntatically quite clean. I still am sure it'll end up being a simple oversight somewhere that I'll slap my forehead over though. I'll update here when I reach the conclusion.