> You'll need to make some sort of
> pager for your program.  In fact, $= isn't even needed, then.
> 
>   #!/usr/bin/perl -w
> 
>   use strict;
> 
>   sub pager {
>     my ($fh, $func, $pause, $lines) = @_;  # grab the args
>     local (*READ, *WRITE, *FH, *SAVE);  # create local to use here
> 
>     pipe READ, WRITE;  # open the pipes for in and out
>     *FH = $fh;         # ??? Help me here, assigns reference
>                        # of $fh ???
>     open SAVE, ">&FH";  # output SAVE
>     open FH, ">&WRITE"; # also output FH
>                          #why two above?
>     my $old = select FH; # save FH
> 
>     $func->();  # ??? Help here also, does this call passed func?
> 
>     close FH;     # close FH
>     close WRITE;  # close ouput
> 
>     open FH, ">&SAVE";  # reopen FH, as output, why?
>     close SAVE;  # close SAVE, which did what?
>     
>     while (<READ>) {
>       print;
>       $pause->() if $. % $lines == 0; # understand %, but
>     }                                 # confused by $pause->()
>      
>     close READ;
> 
>     select $old;  # seld old FH
>   }
> 
>   pager(\*STDOUT, sub { print `ls -lag` }, sub { <STDIN> }, 20);
> 
> If you need an explanation of this code, I'll gladly give one in the
> morning.  Until then, I really need some sleep. ;)

I am a patient man and respect the need to sleep.  Besides, I didn't
check e-mail again until about 30 minutes ago, so there was no hurry.
:)

I added comments above to try to show what I can see and what I'm not
sure of.  Any explaniation would be usefull.  Thanx.

--Alan

__________________________________________________
Do You Yahoo!?
Get personalized email addresses from Yahoo! Mail - only $35 
a year!  http://personal.mail.yahoo.com/

Reply via email to