Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re: Broken Write function? Does anyone have Magic fixer ability?

by davido (Archbishop)
on Jan 11, 2013 at 00:26 UTC ( #1012769=note: print w/ replies, xml ) Need Help??


in reply to Broken Write function? Does anyone have Magic fixer ability?

You don't see any problems here?

$i = 0; my $filename2 = "invaildAddress"; $arrayLength = scalar(@addressSave); print $arrayLength ."\n"; open(IN2 , '>', $filename2); print IN "Invalid Addresses:\n\n\n"; while($i > $addressL){ ##########BROKE? print IN2 "City = " . $invalidAdd[$i]->{City} . "\n"; print IN2 "State = " . $invalidAdd[$i]->{State} . "\n"; print IN2 "Zip = " . $invalidAdd[$i]->{Zip} . "\n"; print IN2 "Address = " . $invalidAdd[$i]->{Address} . "\n"; print IN2 "Po Box = " . $invalidAdd[$i]->{PoBox} . "\n"; print IN2 "Suite = " . $invalidAdd[$i]->{Suite} . "\n"; print IN2 "Misc data = " . $invalidAdd[$i]->{MiscData} . "\n\n"; $i++; } close(IN2);

First you set $i to 0. Then you open a file with the handle "IN2" for output, but fail to check open for success. Then you print a line to the closed filehandle named "IN". Then you have a while loop that never executes because $i still holds zero, which should never be greater than $addressL. Since the only lines that print to IN2 are inside of a loop that never executes, you get no output. Within your loop at least you're trying to print to the correct filehandle.


Dave


Comment on Re: Broken Write function? Does anyone have Magic fixer ability?
Download Code
Re^2: Broken Write function? Does anyone have Magic fixer ability?
by ProgrammerJutsu on Jan 11, 2013 at 00:34 UTC
    Yeah i meant to fix this on the site. I caught most of those errors on my main code. Still with all those things fixed its not printing values to the invalid address document, not to mention the regular expression that checks if the source code has an error message is not working properly.

      So are you asking for help on code that differs from what is posted in this thread? Why don't you go ahead and fix all of the errors I mentioned, and then follow up in this thread with new code samples if you're still having errors.

      If this is going to be an iterative process we're going to have to see what the latest version of the code we're debugging looks like.


      Dave

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (13)
As of 2014-11-26 13:08 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My preferred Perl binaries come from:














    Results (171 votes), past polls