
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