免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 3825 | 回复: 8
打印 上一主题 下一主题

请问能否在一段程序中连续使用glob操作符 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2003-02-19 15:45 |只看该作者 |倒序浏览
我单独放上这一段赋值没有问题,程序正常结束
my @OctFile= glob "$Dir/mail*200210*.bak";
...
但连续给列表赋值就出错
my @OctFile= glob "$Dir/detail*200210*.bak";
my @NovFile= glob "$Dir/detail*200211*.bak";
my @DecFile= glob "$Dir/detail*200212*.bak";
....
系统执行报:
glob failed (child exited with status 1) at ./reol.pl line 7.
glob failed (child exited with status 1) at ./reol.pl line 8.
glob failed (child exited with status 1) at ./reol.pl line 9.
...

论坛徽章:
0
2 [报告]
发表于 2003-02-19 21:07 |只看该作者

请问能否在一段程序中连续使用glob操作符

奇怪,不知道什么问题,
不过glob可以使用<>;代替
如:my @OctFile= <$Dir/mail*200210*.bak>;;

论坛徽章:
1
荣誉会员
日期:2011-11-23 16:44:17
3 [报告]
发表于 2003-02-20 00:07 |只看该作者

请问能否在一段程序中连续使用glob操作符

我測試過..應該沒錯.. 我猜測..
應該是$Dir的問題..
如果是windows平台...
你有沒有將 "\"用"\\"表示??
否則他執行一定是錯誤的..

论坛徽章:
0
4 [报告]
发表于 2003-02-20 22:30 |只看该作者

请问能否在一段程序中连续使用glob操作符

而且试验程序是没有问题的,可以正常执行
但多加上几个就出错了
我还是过用<*>;匹配,错误提示是一样的
真是很郁闷

论坛徽章:
1
荣誉版主
日期:2011-11-23 16:44:17
5 [报告]
发表于 2003-02-21 03:10 |只看该作者

请问能否在一段程序中连续使用glob操作符

你实验程序用的是mail, 后边用的又是detail, 不知是否这个原因

论坛徽章:
0
6 [报告]
发表于 2003-02-21 10:25 |只看该作者

请问能否在一段程序中连续使用glob操作符

不好意思写一个程序,要做两个任务,只是关键字不一样。。汗
贴了detail的错误信息,其实都是一样的错误

论坛徽章:
1
荣誉版主
日期:2011-11-23 16:44:17
7 [报告]
发表于 2003-02-22 08:27 |只看该作者

请问能否在一段程序中连续使用glob操作符

Question:

http://www.tug.org/pipermail/latex2html/2000-July/000699.html

When I run latex2html I obtained always this message

glob failed (child exited with status 139) at
/kepler1/visiteurs/oscar/bin/latex2html line 4403.
glob failed (child exited with status 139) at
/kepler1/visiteurs/oscar/bin/latex2html line 4408.

What am I doing wrong ? What does "glob failed" mean ?
Should I update something ? If it is the case, could you point me the rigth
updates ?

Thanks in advance
Best regards
-----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------
Answer:

http://www.tug.org/pipermail/latex2html/2000-July/000700.html

Do you have an antivirus program running? I ask this because Norton
AntiVirus and MacAfee cause precisely the problems you were having with
globbing. If you do, deactivate them and try again (you may also need to
reinstall).

There's a little more on this in previous messages at:
http://www.xray.mpe.mpg.de/mailing-lists/latex2html/1999-03/msg00110.html
http://www.xray.mpe.mpg.de/mailing-lists/latex2html/1999-02/msg00069.html
http://www.xray.mpe.mpg.de/mailing-lists/latex2html/1999-02/msg00068.html

What is globbing? See http://www.tuxedo.org/~esr/jargon/html/entry/glob.html
where it says:

"To expand special characters in a wildcarded name, or the act of so doing
(the action is also called `globbing').

Steve Mayer

论坛徽章:
1
荣誉版主
日期:2011-11-23 16:44:17
8 [报告]
发表于 2003-02-22 08:32 |只看该作者

请问能否在一段程序中连续使用glob操作符

还是不对,你的问题是不能连续,唉,长叹

论坛徽章:
1
荣誉会员
日期:2011-11-23 16:44:17
9 [报告]
发表于 2003-02-22 11:13 |只看该作者

请问能否在一段程序中连续使用glob操作符

glob EXPR
Returns the value of EXPR with filename expansions such as the standard Unix shell /bin/csh would do. This is the internal function implementing the <*.c>; operator, but you can use it directly. If EXPR is omitted, $_ is used. The <*.c>; operator is discussed in more detail in perlop/"I/O Operators".

Beginning with v5.6.0, this operator is implemented using the standard File::Glob extension. See File::Glob for details.
==========================================
File::Glob

Since v5.6.0, Perl's CORE::glob() is implemented in terms of bsd_glob(). Note that they don't share the same prototype--CORE::glob() only accepts a single argument. Due to historical reasons, CORE::glob() will also split its argument on whitespace, treating it as multiple patterns, whereas bsd_glob() considers them as one pattern.
NOTE:
Win32 users should use the real slash. If you really want to use backslashes, consider using Sarathy's File:osGlob, which comes with the standard Perl distribution.

我真的看不出來,連續用glob為什麼會出錯,
至少在Unix,是沒有問題的...M$...沒用過ActivePerl...
或許是Perl for 其他OS的Bug吧..
要不更新Perl到最新版5.8吧..

我的測試script..
#!/usr/bin/perl
$dir = '/apile/perl/ttt';
my @xx = glob "$dir/detail*2001*.bak";
my @yy = glob "$dir/detail*2002*.bak";

for(@xx){
print ;
print "\n";
}
for(@yy){
print ;
print "\n";
}
output:
/apile/perl/ttt/detailXXX20011111XXX.bak
/apile/perl/ttt/detailXXX20011112XXX.bak
/apile/perl/ttt/detailXXX2001XXX.bak
/apile/perl/ttt/detailXXX20021112XXX.bak
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP