这个脚本有什么问题?帮助PLZ !!!! [英] What is wrong in this script ??? help plz!!!!

查看:52
本文介绍了这个脚本有什么问题?帮助PLZ !!!!的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,


先谢谢!!!!


我有一个配置文件&我正在读取该文件。我正在使用配置文件中指定的值之一。试图将目录中的文件放入数组中。


问题是当我尝试打印数组变量时,即使我已经放置了一些文件,它也没有任何价值在搜索目录下...


不知道哪里出错了???任何人都可以帮我这个???


脚本是这样的:

Hi All,

Thanks in Advance !!!!

I have one config file & am reading that file.later i am using one of the value specified in the config file & trying to get the files placed in the directory into the array.

problem is when i try to print the array varaible it doesn''t hold any value even though i have placed some files under searching directory...

don''t know where it''s going wrong ??? can any one help me on this ???

script goes like this :

展开 | 选择 | 换行 | 行号

推荐答案

您发布的代码肯定不会达到预期效果。 %PARAMS是一个哈希(正如你所写的那样),而不是一个数组。您真的需要查找有关如何定义哈希并阅读它们的教程。 A has与数组的不同之处在于它具有key =>值对。您应该查找有关使用它们的教程,然后尝试重新编写此代码。


*提示:填充哈希时,你需要将文件句柄放入类似while循环的东西,否则你只会得到文件的第一行。


问候,


杰夫
The code you have posted will definitely not do what you are expecting. The %PARAMS is a hash (as you have written it) and not an array. You really need to look up a tutorial on how to define a hash and to read them. A has is different from an array in that it has a key=>value pair. You should look up a tutorial on using them and then try to re-write this code.

*Hint: When populating the hash, you will want to put the filehandle into something like a while loop, otherwise you will only get the first line of the file.

Regards,

Jeff


感谢杰夫的耐心回复...

让我告诉你,当我使用Eclipse工具运行这个脚本时,这个脚本运行良好..

但问题是当我尝试通过cmd行运行相同的脚本时,我赢了没有得到预期的结果。


无论如何,感谢你对哈希的宝贵意见......肯定会经历这个&回复你。


问候,

Vijayarl
Thanks Jeff for your patience reply...

let me tell you, this script works well when i run this script using Eclipse tool..
but the problem is when i try to run the same script through cmd line, i won''t get the desired result.

Anyway''s thanks for your valuable input on hash...for sure will go through that & get back to you.

Regards,
Vijayarl


尝试更换数组@files

try replacing the array @files

展开 | 选择 | Wrap | 行号


这篇关于这个脚本有什么问题?帮助PLZ !!!!的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆