2
eErrorT ChainCtrlExit (ChainCtrlT * pChainCtrl)
ChanT* ChainCtrlGetBitStreamChan (ChainCtrlT * pChainCtrl, 
char * name 
)
eErrorT ChainCtrlInit (ChainCtrlT * pChainCtrl, 
char * name, 
int instance, 
void * pOwner 
)

int SymContDecNamesCount = (sizeof(SymContDecNames)/sizeof(SymContDecNames[0]))
char* SymContEncNames[]
int SymContEncNamesCount = (sizeof(SymContEncNames)/sizeof(SymContEncNames[0]))

I want to extarct only function arguments ...that is 

OUTPUT I NEED extract only function definition arguments in one line

 ChainCtrlT * pChainCtrl
 ChainCtrlT * pChainCtrl, char * name 
 ChainCtrlT * pChainCtrl, char * name, int instance, void * pOwner  

MY CODE

open(FILE, "< functions2.txt") or die $!;
open(FILE1, "> functions3.txt") or die $!;            

my @Array1=<FILE>;
foreach my $text (@Array1){
   $text =~ /\((.+)\)/;
   print FILE1 $text;
 }

But it is extracting everything into new file. Basically dulication of file content

1 Answer 1

2
open(my $FILE, "<", "functions2.txt") or die $!;
open(my $FILE1, ">", "functions3.txt") or die $!;            


my $s = do { local $/; <$FILE>; };
while ($s =~ /^ \S+ \s+ \S+ \s* \( (.+?) \) /xsmg) {
  my $arg = $1;
  $arg =~ tr|\r\n||d;
  print $FILE1 "$arg\n";
}
Sign up to request clarification or add additional context in comments.

2 Comments

works fine. As i am new to perl, it will be great if you could share some links to understand how to solve such issue rather than just copying blindly your code.
@Ad-vic check perldoc documentation => link1 link2 link3

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.