gao perlone wrote:
> I am new to Perl.
> I want to let the Perl help me do some things which need repeated
> execute! For example,ask Perl print the perlfaq file and redirect to a
> .rtf File,but the perlfaq has 9 files from perlfaq1 to perlfaq9.So I
> write a program like below:
> 
> #!usr/bin/perl
> 
> local $i=2;
> LOOP:while($i<10)
> {     
>       @prog=("perldoc","perlfaq$i");
> 
>       pipe(exec(@prog),"perlfaq$i.rtf"))
> 
>       $i++;
> 
>       next LOOP;

This next is starting your loop all over again - delete it.

> }
> 
> But this program print the first perlfaq2,then it exit.
> I don't know what problem I have meeted! so gain some help here.
> Please give a example on how to do this.thanks!

pod2text is the module that converts pods, so better to use it rather
than shelling out to perldoc.

use strict;
use warnings;
use Config;
use Pod::Text;

my $pod_dir = "$Config{archlib}/pod";   # directory where core pod files are

for (2 .. 9) {
        open OUT, ">perlfaq$_.txt" or die "create perlfaq$_.rtf: $! ($^E)";
        pod2text ("-80", "$pod_dir/perlfaq$_.pod", \*OUT);
        close OUT;
}

__END__

-- 
  ,-/-  __      _  _         $Bill Luebkert    Mailto:[EMAIL PROTECTED]
 (_/   /  )    // //       DBE Collectibles    Mailto:[EMAIL PROTECTED]
  / ) /--<  o // //      Castle of Medieval Myth & Magic http://www.todbe.com/
-/-' /___/_<_</_</_    http://dbecoll.tripod.com/ (My Perl/Lakers stuff)
_______________________________________________
ActivePerl mailing list
ActivePerl@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to