Beefy Boxes and Bandwidth Generously Provided by pair Networks Bob
good chemistry is complicated,
and a little bit messy-LW
 
PerlMonks

Re: Re: Re: "Useless use of private variable in void context"

by BrowserUk (Pope)
 | Log in | Create a new user | The Monastery Gates | Super Search | 
 | Seekers of Perl Wisdom | Meditations | PerlMonks Discussion | 
 | Obfuscation | Reviews | Cool Uses For Perl | Perl News | Q&A | Tutorials | 
 | Poetry | Recent Threads | Newest Nodes | Donate | What's New | 

on Jun 20, 2003 at 22:18 UTC ( #267730=note: print w/ replies, xml ) Need Help??

in reply to Re: Re: "Useless use of private variable in void context"
in thread "Useless use of private variable in void context"

As a pure guess, check the line before the GeneratePassword() line and see if you haven't type a comma (,) on the end rather than a semi-colon (;)?

this is what I'm looking for, correct?

Essentially yes. I would now move slowly backwards through the code until the line number becomes 2765.

At that point, you wil have found the limit of the code that perl is taking as being "one line". You can then start looking for things like commas instead of semicolons, unclosed ""s or ''s etc. try commenting out the whole of th e previous line. Does the line number change then?


Examine what is said, not who speaks.
"Efficiency is intelligent laziness." -David Dunham
"When I'm working on a problem, I never think about beauty. I think only how to solve the problem. But when I have finished, if the solution is not beautiful, I know it is wrong." -Richard Buckminster Fuller



Comment on Re: Re: Re: "Useless use of private variable in void context"
Download Code
Solution.
by Seumas (Curate) on Jun 20, 2003 at 22:34 UTC

    Okay, I should have been able to start deducing the comma thing by that point, too. I'm not sure why I was so oblivious to it. I did find the culprit however. I had nailed the problem down to 20 lines of code and your comment about a comma (makes absolute sense) lead me to the precise line that was glitching.

    I'm embarrassed to admit this, but the following is the problem that was tripping me up. Note that the code has behaved exactly as wanted and expected for over a year with this line in it - go figure!

    Problematic line:

    if (defined($duplicate_email_address), defined($matched_uid))

    Obvious to anyone with a brain and a set of eyes (except myself apparently), the problem with the above line is that there is a comma where the && operand should be.

    All I can offer in my defense is that I never suspected a problem like that because I'd have expected it to cause a syntax error or prevent compiling.

    I can also now recall the exact step that lead me to this problem over a year ago when I wrote this new batch of code. I had copied the contents of something like my ($foo, $bar, $blah) = $sth->fetchrow_array; and then used that in a conditional and never went back to modify the syntax.

    This was the last thing I was investigating. Every time I went back to check this code and see if I could find the cause of that error, I was looking for things more like a variable that was being defined but never used or something. Gah! So frustrating!

    On a positive side, I rarely make the same mistake twice and I learned a thing or two from this thread. Thanks again, monks.

      ++ for letting us know the resolution.

      On the comma thing. I have a habit of starting out with a lines like

      $i++ if $some_condition; #or push @a, 'fred' while @a < 10;

      And then realising that I need to do something else in the if or while and so instead of restructuring the line to the

      if(..) { ....; ....; } or

      while( ... ) { ...; ....; }

      I do

      $j-- , $i++ if $some_condition; #or print scalar @a , push @a, 'fred' while @a < 10;

      This is usually a temporary step while I try something out or when debugging, but I've been bitten enough times by the "comma thing" to recognise the symtoms.


      Examine what is said, not who speaks.
      "Efficiency is intelligent laziness." -David Dunham
      "When I'm working on a problem, I never think about beauty. I think only how to solve the problem. But when I have finished, if the solution is not beautiful, I know it is wrong." -Richard Buckminster Fuller


Re^4: "Useless use of private variable in void context"
by Anonymous Monk on Aug 22, 2008 at 20:57 UTC
    it must be somewhere else in the code. I got the same error in the following line chop($fai_in) if(length($fai_in) > 0); when I comment this line got the error in next line. The problem was however was in the following line which missed the brackets while($cust_id, $field_association_id = $sth->fetchrow_array()) which should be while(($cust_id, $field_association_id) = $sth->fetchrow_array()) it solved the problem
Login:
Password
remember me
What's my password?
Create A New User

Node Status?
node history
Node Type: note [id://267730]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (9)
ikegami
GrandFather
jdporter
atcroft
herveus
MidLifeXis
ssandv
AndyZaft
Neighbour
As of 2010-09-06 02:59 GMT
Sections?
Seekers of Perl Wisdom
Cool Uses for Perl
Meditations
PerlMonks Discussion
Categorized Q&A
Tutorials
Obfuscated Code
Perl Poetry
Perl News
See About the sections of PerlMonks
Information?
PerlMonks FAQ
Guide to the Monastery
What's New at PerlMonks
Voting/Experience System
Tutorials
Reviews
Library
Perl FAQs
Other Info Sources
Find Nodes?
Nodes You Wrote
Super Search
List Nodes By Users
Newest Nodes
Recently Active Threads
Selected Best Nodes
Best Nodes
Worst Nodes
Saints in our Book
Leftovers?
The St. Larry Wall Shrine
Offering Plate
Awards
Craft
Snippets Section
Code Catacombs
Quests
Editor Requests
Buy PerlMonks Gear
PerlMonks Merchandise
Planet Perl
Perlsphere
Use Perl
Perl.com
Perl 5 Wiki
Perl Jobs
Perl Mongers
Perl Directory
Perl documentation
CPAN
Random Node
Voting Booth?

My favourite poll on PerlMonks is ...

Your first Perl Book - the first one ever
Average number of caffeinated beverages per work day - the poll with the highest participation
My Thoughts on the New Voting/Experience System - the poll with the fewest votes cast
When I grow up, I want to be: - one of the polls with the fewest options
Perl 6 will primarily be: - the first one on Perl6
When I see a poll - one of the many polls about polls
this poll ;-)
yet to come
none - I hate polls. Bah.
some other

Results (95 votes), past polls