读书人

perl解决办法

发布时间: 2012-06-02 14:16:14 作者: rapoo

perl
no Path grade cha FMI Utterances
002 App-C1\Files\student\stu001 001 00 a _optmistic_ me NO
003 App-C1\Files\student\stu002 002 00 a _NOISE_ rt _SE_
004 App-C1\Files\student\stu002 002 00 a optmistic _SE_
001 App-C1\Files\student\stu002 002 00 a s CON EL ZO _SE

重组上面的文件,使其输出格式为App-C1\Files\student\stu001\001.no _optmistic_ me NO,然后在屏幕输出,怎么实现啊,急啊

[解决办法]

Perl code
#!/usr/bin/env perluse strict;use warnings;while (<DATA>) {    my @d = split /\s+/;    print "$d[1]\\$d[2].no @d[5..$#d]\n";}__DATA__002 App-C1\Files\student\stu001 001 00 a _optmistic_ me NO003 App-C1\Files\student\stu002 002 00 a _NOISE_ rt _SE_004 App-C1\Files\student\stu002 002 00 a optmistic _SE_001 App-C1\Files\student\stu002 002 00 a s CON EL ZO _SE
[解决办法]
Perl code
print "$d[1]\\$d[2].no @d[5..$#d]\n"; 

读书人网 >perl python

热点推荐