抱歉有个拼写错误

在 2011-1-31,下午12:13, tr 写道:

> 看起来像遍历文件夹,一般这么做
> 
> opendir DH, 'e:/dictionary';
> my @files = readdir(DH);
> closedir DH;
> 
> foreach my $file(@files) {
>       next if $file =~ /^\.{1,2}$/;
> 
>       my $full_path = 'e:/dictionary/'. $file;
>       if (-f $full_path) {
>               open FH .....
>       }
> }
> 
> 在 2011-1-29,下午11:01, 方伟 写道:
> 
>> 英语不好,文档看不懂。谢谢你
>> 
>> 在 2011年1月29日 下午9:16,Robin Lee <[email protected]> 写道:
>>> seek(FILE, 0, 0);
>>> 可以将句柄的读取点复位
>>> 详见 perldoc -f seek
>>> 
>>> 2011/1/29 方伟 <[email protected]>
>>>> 
>>>> 我在XP系统上写了一个查字典的小程序:
>>>> use warnings;
>>>> open FILE,'E:\dictionary';
>>>> while(1){chomp($word=<STDIN>);
>>>>          while(<FILE>){print if /$word/;}
>>>>         }
>>>> close FILE;
>>>> 上面的程序不能够实现查完一个单词后接着查下一个单词,然后我修改了一下就可以了:
>>>> use warnings;
>>>> while(1){open FILE,'E:\dictionary';
>>>>          chomp($word=<STDIN>);
>>>>          while(<FILE>){print if /$word/;}
>>>>         }
>>>> close FILE;
>>>> 我感到疑惑的是:难道文件句柄打开以后就只能使用一次吗?
>>>> 
>>>> --
>>>> 您收到此邮件是因为您订阅了 Google 网上论坛的"PerlChina Mongers 讨论组"论坛。
>>>> 要向此网上论坛发帖,请发送电子邮件至 [email protected]。
>>>> 要取消订阅此网上论坛,请发送电子邮件至 [email protected]。
>>>> 若有更多问题,请通过 http://groups.google.com/group/perlchina?hl=zh-CN 访问此网上论坛。
>>>> 
>>> 
>>> --
>>> 您收到此邮件是因为您订阅了 Google 网上论坛的"PerlChina Mongers 讨论组"论坛。
>>> 要向此网上论坛发帖,请发送电子邮件至 [email protected]。
>>> 要取消订阅此网上论坛,请发送电子邮件至 [email protected]。
>>> 若有更多问题,请通过 http://groups.google.com/group/perlchina?hl=zh-CN 访问此网上论坛。
>>> 
>> 
>> -- 
>> 您收到此邮件是因为您订阅了 Google 网上论坛的“PerlChina Mongers 讨论组”论坛。
>> 要向此网上论坛发帖,请发送电子邮件至 [email protected]。
>> 要取消订阅此网上论坛,请发送电子邮件至 [email protected]。
>> 若有更多问题,请通过 http://groups.google.com/group/perlchina?hl=zh-CN 访问此网上论坛。
>> 
> 

-- 
您收到此邮件是因为您订阅了 Google 网上论坛的“PerlChina Mongers 讨论组”论坛。
要向此网上论坛发帖,请发送电子邮件至 [email protected]。
要取消订阅此网上论坛,请发送电子邮件至 [email protected]。
若有更多问题,请通过 http://groups.google.com/group/perlchina?hl=zh-CN 访问此网上论坛。

回复