- 论坛徽章:
- 0
|
本帖最后由 Perl_Er 于 2011-09-25 16:10 编辑
举个例子,其余的你自己写- #!/usr/bin/perl -w
- use strict;
- use Data::Dumper;
- my @ary;
- my $count = 0;
- while(<DATA>){
- print;
- print "\n";
-
- @{$ary[$count++]} = unpack("A2 x2 A1 x2 A6 x2 A5 x2 A7 x2 A*");
- }
- print Dumper \@ary;
- __DATA__
- 13 1 345652 8131415 王泽
- 13 1 345652 58551 8131415 王泽宁
- 13 1 123454 89074 1234568 麻辣鸡丝
复制代码13 1 345652 8131415 王泽
13 1 345652 58551 8131415 王泽宁
13 1 123454 89074 1234568 麻辣鸡丝
$VAR1 = [
[
'13',
'1',
'345652',
'',
'8131415',
'王泽'
],
[
'13',
'1',
'345652',
'58551',
'8131415',
'王泽宁'
],
[
'13',
'1',
'123454',
'89074',
'1234568',
'麻辣鸡丝'
]
]; |
|