Problem with setting the Page Length 
Author Message
 Problem with setting the Page Length

I'm having problems with Perl setting the page length correctly.
I am trying to set the $= variable to something else but when I'm
using write on something othert than STDOUT it seems that this
variable is ignored and it keeps thinking the page length is about
66 lines.

Below I've got a small minimal program that shows the problem.
According to my understanding the following program should create a
new page after 200 lines, instead it creates a new page after about
every 66 lines.  However if I just let it use STDOUT it works fine.

Could someone show me where I've gone wrong?

BTW: H/W Mips M-120 running RISC/os 4.52, S/W Perl v4.0.1.4 pl10.

P.S. To show the difference between working and non-working output
remove/insert the # on the 5th line.

Cut below here (don't forget the .sig)------------------------------>
#!/usr/local/bin/perl
# Currently this example exhibits the problem.
# Remove the leading # on the next line to get it to work correctly
# via STDOUT (I need it to work via OF).
#$good=1;

if (!$good)
{
        open(OF, ">-");

Quote:
}

$= = 200;
for ($i=0;$i<210;$i++)
{
        if ($good)
        {
                write;
        }
        else
        {
                write(OF);
        }
Quote:
}

if (!$good)
{
        close(OF);

Quote:
}


$i
.

format STDOUT_TOP =
NEW PAGE
.


$i
.

format OF_TOP =
NEW PAGE
.
CUT HERE ------------------------------------------------------------>
--
Andrew STEELE            BHP Information Technology, Newcastle, NSW, Australia.

  "All that is required for evil to triumph, is for good people to do nothing"
                         -- Edmund Burke



Tue, 05 Apr 1994 12:44:11 GMT  
 
 [ 1 post ] 

 Relevant Pages 

1. Perl tuning/speed question: all subsets of a set of length k -- keeping the inital order

2. Setting up a variable length format at runtime

3. unknown warning when setting scale length

4. Format page length

5. setting page orientation in WORD

6. set the page header / footer

7. set startup page

8. Setting Page Backgrounds

9. Error in LWP [Bad arg length for Socket::unpack_sockaddr_in, length is 0, should be 16]

10. Error in LWP [Bad arg length for Socket::unpack_sockaddr_in, length is 0, should be 16]

11. Bad arg length for Socket::unpack_sockaddr_in, length is 0

12. Error in LWP [Bad arg length for Socket::unpack_sockaddr_in, length is 0, should be 16]

 

 
Powered by phpBB® Forum Software