Prsumably you have two things happening : 1) you print screen fulls of data; 2) You pause for user input. Obviously the printing will cease when you get to the $answer = <STDIN>;. Thus you problem is how to simulate more when you print the other stuff. You can do this easily by defining a custom print function.

sub print_more; # declare a proto my $more = 20; # twenty lines then stop my $wrap = 80; # assume that we will wrap at 80 cols print_more $some_big_string, @big_array; { my $line_count = 0; # declare a closure to remember lines printed sub print_more { my $data = join'', @_; my @data_lines = split "\n", $data; for my $line (@data_lines) { # add one line if less than $wrap long (no wrap) # or more for long lines that will wrap $line_count += int ((length($line))/$wrap) + 1; if ($line_count < $more ) { print $line, "\n"; } else { print "[Hit Enter key to continue]"; <STDIN>; $line_count = int ((length($line))/$wrap) + 1; print $line, "\n"; } } } }

cheers

tachyon

s&&rsenoyhcatreve&&&s&n.+t&"$'$`$\"$\&"&ee&&y&srve&&d&&print


In reply to Re: print 'more'. by tachyon
in thread print 'more'. by artist

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.