berlins has asked for the wisdom of the Perl Monks concerning the following question:

I have a report that has a control break logic that requires me to manipulate the $- variable however, my perl does not allow me to perform $- --; or $- = 0; to affect the Top of Page thingy. Help Please!!

Sorry for the dup ?.

(2005-08-16) jdporter Unconsidered for reap as dupe; dupe Reaped: Format problems reaped instead.

Retitled by davido from 'formats'.

Replies are listed 'Best First'.
Re: Format problems
by Tanktalus (Canon) on Aug 17, 2005 at 02:08 UTC

    I'm not entirely sure what you're attempting to do here. Are you trying to force the format to go to the next page? Not that I'm sure how to do that, either, as I've avoided formats pretty much since the second day with perl because I found them a bit convoluted at first, and now I just simply don't find them flexible enough. However, Perl6::Form looks promising - maybe you want to look at that to find a simpler way to solve your problem.

      Yes, I am trying to force the top of page to print without issuing a number of writes. The Gov't contract uses perl 5.005.03 and upgrading is difficult. The following is the prtion of code where the problem occurs. The logic stating with: print ("what the hell!!!\n"); executes however the decrement to the $- variable does not take as wel as setting $- to 0 and the write of the format top does not execute.
      while (%data = &dbnextrow($dbproc05,1)) { if ($numRows == 0) { $numRows = 49; } if ($first_time == 1 ) { $dataRows = 1; $old_edgar_id = $data{"edgar_id"}; $edgar_id = $data{"edgar_id"}; $blk_count = $data{"blk_count"}; $first_time = 0; format_top_name REPORT "REPORT_TOP"; format_name REPORT "BLANK_FORMAT"; write (REPORT); $numRows = $numRows - 11; } $edgar_id = $data{"edgar_id"}; if ($old_edgar_id eq $edgar_id) { format_name REPORT "DATA_FORMAT2"; write (REPORT); $numRows--; } else { $old_edgar_id = $data{"edgar_id"}; $blk_count = $data{"blk_count"}; if ( $numRows >= 7 ) { format_name REPORT "COL_NAME_FORMAT"; write (REPORT); $numRows = $numRows - 7; } else { print ("what the hell!!!\n"); $- --; $- --; $- --; $- --; $- = 0; format_top_name REPORT "REPORT_TOP"; format_name REPORT "BLANK_FORMAT"; write (REPORT); $numRows = $numRows = 49; } $accession_number = $data{"accession_number"}; $sub_type = $data{"$sub_type"}; $received_date = $data{"received_date"}; format_name REPORT "DATA_FORMAT2"; write (REPORT); $numRows--; } }