how about if the file it too big ? > -----邮件原件----- > 发件人: [email protected] [mailto:[email protected]] > 代表 Fayland Lam > 发送时间: 2009年11月日 20:56 > 收件人: [email protected] > 主题: [PerlChina] Re: about open() and print > > if (/\[error]|error/) { > print; > my $line = <LOG>; > print $line; > } > > 2009/11/30 earthminator <[email protected]>: > > #!/usr/bin/perl > > use strict; > > use warnings; > > my $log_file = '/export/home/wanghao/1116/LOG.txt'; > > open(LOG,"< $log_file") or die "Unable to open logfile:$!\n"; > > while(<LOG>){ > > print if /\[error]|error/; > > } > > close(LOG); > > 写了如上程序,能够成功调出LOG.txt中含有error的行,当是我想把含 > 有error这一行的下一行也同时输出,请问该怎么弄? > > > > > > > > > > > > > -- > Fayland Lam // http://www.fayland.org/ > >
--~--~---------~--~----~------------~-------~--~----~ 您收到此信息是由于您订阅了 Google 论坛“PerlChina Mongers 讨论组”论坛。 要在此论坛发帖,请发电子邮件到 [email protected] 要退订此论坛,请发邮件至 [email protected] 更多选项,请通过 http://groups.google.com/group/perlchina?hl=zh-CN 访问该论坛 -~----------~----~----~----~------~----~------~--~---
