Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options

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.


Replies are listed 'Best First'.
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.


Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1012769]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (4)
As of 2018-06-23 05:32 GMT
Find Nodes?
    Voting Booth?
    Should cpanminus be part of the standard Perl release?

    Results (125 votes). Check out past polls.