Article 11561 of comp.lang.perl:
Newsgroups: comp.lang.perl
Path: feenix.metronet.com!news.utdallas.edu!convex!cs.utexas.edu!howland.reston.ans.net!europa.eng.gtefsd.com!library.ucla.edu!ihnp4.ucsd.edu!network.ucsd.edu!btree!mdimeo
From: [email protected] (Matthew DiMeo)
Subject: Re: perlman revisited.
Message-ID: <[email protected]>
Date: Tue, 15 Mar 94 23:29:42 GMT
References: <[email protected]> <[email protected]> <[email protected]>
Organization: /usr/lib/news/organi[sz]ation
Lines: 71

In article <[email protected]>,
Jon Connell <[email protected]> wrote:
>
>No, it was somebody elses mini-script which piped the man-page output
>looking for the function a certain no. of spaces into the line.
>

I missed the beginning of the thread, but I'm guessing you're talking about
my script.  Here it is again, for those who missed it.  Run it like this:

% pfunk push

and you'll get this:

    push(ARRAY,LIST)
            Treats ARRAY (@ is optional) as a stack, and  pushes
            the  values  of  LIST  onto  the  end of ARRAY.  The
            length of ARRAY increases by  the  length  of  LIST.
            Has the same effect as

                for $value (LIST) {
                     $ARRAY[++$#ARRAY] = $value;
                }

            but is more efficient.

--------------------- cut --------------------
#!/usr/local/bin/perl

# pfunk.  Written by Matthew DiMeo, [email protected].  Distribute
# freely, but give credit where credit is due, and blame to somebody else :-).


# look up a function in the perl man page.

$func = shift || die "Usage: $0 funcname\n" ;

$func = "m/PATTERN/gio" if $func eq "m/PATTERN/" ||
                          $func eq "/PATTERN/" ||
                          $func eq "//" ;

$func = "s/PATTERN/REPLACEMENT/gieo" if $func eq "s/" || $func eq "s///" ;

open(MAN, "man perl|") ;

$/ = "\n\n" ;

while(<MAN>) {
   if (/^     $func/o) {
       print ;
       $/ = "\n" ;
       while (<MAN>) {
           if (! /^     /) {
               print "\n" ;
               DONOTHING while ($_ = <MAN>) !~ /^     / ;
           }
           last if /^     \S/ && !/^     $func/o ;
           print ;
       }
       exit(0) ;
   }
}

die "Not found!\n" ;
__END__

If somebody wants to put this on an archive site, go right ahead (let me
know, so I can tell my Mom :-).

-Matt DiMeo
[email protected]