读取points文件
生活随笔
收集整理的這篇文章主要介紹了
读取points文件
小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.
#!/usr/bin/perl -w
use 5.010;
open my ($points),'<','points.txt'
? or die "couldn't read points data: $!\n";
while (<$points>) {
??? next if /^\s*#.*$/;? #跳過(guò)注釋
??? push @xyz,[split];
}
foreach my $pt (@xyz) {
??? print "point ",$i++,": x=$pt->[0],y=$pt->[1], ","z = $pt->[2]\n";
}
?
points.txt文件內(nèi)容為:
#點(diǎn)坐標(biāo)數(shù)據(jù)
1 2 3
4 5 6
7 8 9
總結(jié)
以上是生活随笔為你收集整理的读取points文件的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。
- 上一篇: python config
- 下一篇: linux cut 用法