读取points文件
生活随笔
收集整理的這篇文章主要介紹了
读取points文件
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
#!/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*#.*$/;? #跳過注釋
??? push @xyz,[split];
}
foreach my $pt (@xyz) {
??? print "point ",$i++,": x=$pt->[0],y=$pt->[1], ","z = $pt->[2]\n";
}
?
points.txt文件內容為:
#點坐標數據
1 2 3
4 5 6
7 8 9
總結
以上是生活随笔為你收集整理的读取points文件的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: python config
- 下一篇: linux cut 用法