如题所述
ç¨perlè¿æ¯æºç®åç
open($file,'a.c');
my $annot=0;
my %struc={-int=>0,-double=>0,-char=>0,....};
my @var;
while(<$file>){
if($annot){
if(/.*?\*\/(.*)/){$_=$1;}
}
if(/(.*)?\/\//){$_=$1;}
if(/struct\s+\(w+)/){$struc{$1}=1;}
if(/^\s*(\w+)\s+(\w+)\s*;/){if(exists($struc{$1}){push @var,$2;}}
}
print sort(@var);
åªæ¯ç®åå¤çäºä¸ï¼åint a,b,c,dè¿æ ·çç±»åè¿æ¯è¦ç¹æ®å¤çä¸
open($file,'a.c');
my $annot=0;
my %struc={-int=>0,-double=>0,-char=>0,....};
my @var;
while(<$file>){
if($annot){
if(/.*?\*\/(.*)/){$_=$1;}
}
if(/(.*)?\/\//){$_=$1;}
if(/struct\s+\(w+)/){$struc{$1}=1;}
if(/^\s*(\w+)\s+(\w+)\s*;/){if(exists($struc{$1}){push @var,$2;}}
}
print sort(@var);
åªæ¯ç®åå¤çäºä¸ï¼åint a,b,c,dè¿æ ·çç±»åè¿æ¯è¦ç¹æ®å¤çä¸
温馨提示:答案为网友推荐,仅供参考
第1个回答 2011-11-14
股份vdsfgsdfgdfgdsfgd