search perldocs against each word in a string

I

ioneabu

#!/usr/bin/perl
#file: pdoc.pl searches perldocs
use warnings;
use strict;
pdoc.pl "perldoc individual words string"
output:
perl5005delta
perl561delta
perl581delta
perlmodlib
perlos2
perlport

Is there anything built in that does this? It runs pretty fast
considering it has to load each perldoc into memory and compare against
each word in search string.

use File::Slurp;
use File::Find;
#file: pdoc.pl: search perldocs
my $string = $ARGV[0];
my @string = split /\s+/, $string;
my $count = scalar @string;
my $path = 'c:\perl\lib\pod';
find(\&wanted, $path);
sub wanted
{
my ($contents, $filename);
$filename = $File::Find::name;
if (/\.pod$/)
{
$contents = read_file($filename) ;
s/\.pod$//;
print $_ , "\n"
if $count == grep {$contents =~ /$_/i} @string;
}
}

#thanks!
#wana
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,007
Latest member
obedient dusk

Latest Threads

Top