Jeff, It is returning just 1.I think the result of the expression. -----Original Message----- From: Jeff Pang [mailto:[EMAIL PROTECTED] Sent: Friday, March 30, 2007 2:53 PM To: Nath, Alok (STSD); beginners@perl.org Subject: Re: Need to extract only the function name no brackets reqd.
> 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. > Hello, Given the function definition like below, sub myfunc($,$){ ... } You may extract the function name using the regex, my ($func_name) = $_ =~ /sub\s+(\w+)/; or even, my ($func_name) = /sub\s+(\w+)/; The 'split' is not needed I think. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/