in reply to Keeping form information in CGI

First off, yes, tachyon the values in @classid are only numbers, but thank you for your vigilance.

On a seperate and, I think, somewhat odd note I noticed that whatever I do after I have the open ORGIDATA, ">orig" || die "Couldn't open! $!"; line doesn't happen (i.e. prints don't print etc.). I'm completely baffled as to why.

For example modifying the above code to this:

open ORGIDATA, ">orig" || die "Couldn't open! $!"; for (my $k = 0; $k < @classid; $k++) { if ($classid[$k] != $classid[$k-1]) { print $classid[$k], " ", @{$class[$k]}, " ", $location +[$k], " ", $credits[$k], "<br>\\ n"; } } close ORGIDATA;
prints nothing.
However if the code is amended to comment out the open and close lines the information is printed.

Yes, Zaxo, I am using CGI.pm, I hadn't known about that feature of CGI.pm so I went to do some research to see how it worked. I found the save function and tried using that but it didn't work (functioned same as above). If I missed your point please correct me.

Replies are listed 'Best First'.
Re: Re: Help already received and request for more
by wardk (Deacon) on Jul 03, 2001 at 17:48 UTC
    deryni,

    just a heads up...

    open ORGIDATA, ">orig" || die "Couldn't open! $!"; for (my $k = 0; $k < @classid; $k++) { if ($classid[$k] != $classid[$k-1]) { print $classid[$k], " ", @{$class[$k]}, " ", $location +[$k], " ", $credits[$k], "<br>\\ n"; } } close ORGIDATA;

    if the print within the loop is supposed to output to the "orig" file, then you'll want to use the file handle in the print statement:

    print ORGIDATA $classid[$k], " ", @{$class[$k]}, " ", $locatio +n
      Thank you for that information, I was using the print line with the filehandle but decided
      that in the interest of debugging I'd just have it print on the bottom of the webpage (easier to see if it worked).

      My real question here is why after the open line the print doesn't happen. Regardless of where I'm printing the print just does not occur.
      I have previously opened and closed two other filehandles in the program and there are something like 10 global arrays in the program. I don't know if any of that is important but thought I'd tell you anyway.

        I see you are printing only if the if-test is false, have you tried seeding the file? i.e. open, then print one line, that way if the if-test is never true (another possiblity) you get something. Since it doesn't print to the browser, I would suggest that you aren't getting the test you think you should be in the if.

        keep plugging away...and remember timtowtdi! :-)