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]"; ; $line_count = int ((length($line))/$wrap) + 1; print $line, "\n"; } } } }