Chinaunix

标题: 有了文件句柄,怎么依次读入一行 [打印本页]

作者: jdxyw    时间: 2007-06-12 17:00
标题: 有了文件句柄,怎么依次读入一行
有了文件句柄,怎么依次读入一行?
是不是
open $fileopen ,"...";
while(<fileopen>)
{
     $string=$_;
}
是不是这样就了?
作者: thevoice    时间: 2007-06-12 17:09

  1. my $n = 0;
  2. while(<fileopen>)
  3. {
  4.     $n++;
  5.     print "$n:$_";
  6. }
复制代码

试下你就知道了
作者: alexru    时间: 2007-06-12 18:10
Never forgetting to try and try on
作者: jdxyw    时间: 2007-06-13 18:09
我试过了,没用啊
作者: nkcsx    时间: 2007-06-13 18:10
你那个第一行,把$去掉
作者: jdxyw    时间: 2007-06-13 18:19
谢谢!可以了




欢迎光临 Chinaunix (http://bbs.chinaunix.net/) Powered by Discuz! X3.2