Need to extract only the function name no brackets reqd.
- From: alok.nath@xxxxxx (Alok Nath)
- Date: Fri, 30 Mar 2007 14:36:37 +0530
Hi,
I have this program which extract function names from the files.
My only problem is I want to extract only the function names{no
brackets () needed } .
Currently its extract all words after word sub but it all
returns
the parentheses after that.
my $fileLoc = "//opt//sva//perl//lib//" ;
my $funcCount = 0 ;
opendir (DIR, $fileLoc) || die "Cannot opendir $!" ;
my @libs = readdir(DIR) ;
open (RES, ">out.txt") || die "Cannot open out.txt : $!" ;
foreach (@libs){
if(/pm$/){
open(FILE, $fileLoc.$_) or die("Unable to open $!") ;
print RES "Inside file >> $_ \n" ;
while (<FILE>){
chomp ;
if (/sub/){
my $sub ;
my $subName ;
($sub, $subName) = split /\s+/ ;
# print RES $_ ."\n" ;
print RES $subName."\n" ;
$funcCount ++ ;
}
}
print "\n\n" ;
close(FILE) ;
}
}
print RES "Total Functions : $funcCount \n" ;
close RES ;
closedir DIR ;
Thanks
Alok
.
- Follow-Ups:
- Re: Need to extract only the function name no brackets reqd.
- From: Rob Dixon
- Re: Need to extract only the function name no brackets reqd.
- Prev by Date: Re: perl
- Next by Date: Re: Need to extract only the function name no brackets reqd.
- Previous by thread: Re: perl
- Next by thread: Re: Need to extract only the function name no brackets reqd.
- Index(es):
Relevant Pages
|