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: mdimeo@btree.brooktree.com (Matthew DiMeo) Subject: Re: perlman revisited. Message-ID: <1994Mar15.232942.20663@btree.brooktree.com> Date: Tue, 15 Mar 94 23:29:42 GMT References: <2m212l$7fm@lace.Colorado.EDU> Organization: /usr/lib/news/organi[sz]ation Lines: 71 In article , Jon Connell 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, mdimeo@brooktree.com. 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() { if (/^ $func/o) { print ; $/ = "\n" ; while () { if (! /^ /) { print "\n" ; DONOTHING while ($_ = ) !~ /^ / ; } 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 mdimeo@brooktree.com .