- 论坛徽章:
- 307
|
- #!/usr/bin/perl
- use strict;
- use warnings;
- local $/ = ';';
- while (<DATA>){
- next if (!/\bstudent\(([^()]+)/);
- print join ("\t", grep {/\A\w/} split (/\s*,\s*/, $1)), "\n";
- }
- __DATA__
- /*comment by xxx
- abc = int student(name,sex,
- height,
- weight,
- address);
- comment by xxx*/
- /*add beg by xxx
- A.stu_name = name;
- A.stu_sex = sex;
- A.stu_weight = weight;
- A.stu_add = address;
- abc = int student(A.stu_name,A.stu_sex,A.stu_weight,A.stu_add);
- add end by xxx*/
复制代码
perl abc.pl
------------------------------
name sex height weight address
A.stu_name A.stu_sex A.stu_weight A.stu_add |
|