our只在 package里面出现,

你如果不写package,基本上用不到



2010/6/17 flw <[email protected]>

> “our 声明”本身是词法作用域的,
> 但是“our 声明的变量”的作用域是全局的。
>
> 在 2010年6月7日 下午10:36,rochelle hsu <[email protected]>写道:
>
>  I never use "OUR" declare vars.
>> Take Care of it.
>>
>> 2010/6/7 Liu Yubao <[email protected]>
>>
>> Hi,
>>>
>>> perldoc -f our,our 的作用域是词法作用域,跟 my 一样。
>>>
>>> 可以穿越同一个文件里的多个 package 语句,那是因为你没有用
>>> 大括号把同一文件里的多个 package 隔离开。
>>>
>>>
>>> 下面是我总结的把多个模块放在同一个文件里需要注意的事情,供参考:
>>> ===========================================
>>> 跟把多文件直接合并有如下区别:
>>>  * 如果主程序不在开头,要用package main;
>>>  * 导入此文件内模块的符号不能用use和require,要用MODULE->import()
>>>  * 模块里用包级别的my要把整个模块用大括号括起来
>>>  * 如果模块里有函数外的语句,需要注意模块顺序
>>>  * 模块末尾不需要写1;
>>> ===========================================
>>>
>>>
>>> WENFENG LIU wrote:
>>> > our声明的变量 的作用域是整个文件。 定义可以穿越package,但是不能穿越文件。
>>> >
>>> > 这样理解对吗?
>>> >
>>> > Wfg LIU
>>> >
>>> > thanks
>>> >
>>> >
>>> >
>>> >
>>> ------------------------------------------------------------------------
>>> > Hotmail: Trusted email with Microsoft’s powerful SPAM protection. Sign
>>> > up now. <https://signup.live.com/signup.aspx?id=60969>
>>>  >
>>> > --
>>> > 您收到此邮件是因为您订阅了 Google 网上论坛的“PerlChina Mongers 讨论组”论坛。
>>> > 要向此网上论坛发帖,请发送电子邮件至 [email protected]。
>>> > 要取消订阅此网上论坛,请发送电子邮件至
>>> > [email protected]<perlchina%[email protected]>
>>> 。
>>> > 若有更多问题,请通过 http://groups.google.com/group/perlchina?hl=zh-CN
>>> > 访问此网上论坛。
>>>
>>> --
>>> 您收到此邮件是因为您订阅了 Google 网上论坛的“PerlChina Mongers 讨论组”论坛。
>>> 要向此网上论坛发帖,请发送电子邮件至 [email protected]。
>>> 要取消订阅此网上论坛,请发送电子邮件至 
>>> [email protected]<perlchina%[email protected]>
>>> 。
>>> 若有更多问题,请通过 http://groups.google.com/group/perlchina?hl=zh-CN 访问此网上论坛。
>>>
>>>
>> --
>> 您收到此邮件是因为您订阅了 Google 网上论坛的“PerlChina Mongers 讨论组”论坛。
>> 要向此网上论坛发帖,请发送电子邮件至 [email protected]。
>> 要取消订阅此网上论坛,请发送电子邮件至 
>> [email protected]<perlchina%[email protected]>
>> 。
>> 若有更多问题,请通过 http://groups.google.com/group/perlchina?hl=zh-CN 访问此网上论坛。
>>
>
> --
>  您收到此邮件是因为您订阅了 Google 网上论坛的“PerlChina Mongers 讨论组”论坛。
> 要向此网上论坛发帖,请发送电子邮件至 [email protected]。
> 要取消订阅此网上论坛,请发送电子邮件至 
> [email protected]<perlchina%[email protected]>
> 。
> 若有更多问题,请通过 http://groups.google.com/group/perlchina?hl=zh-CN 访问此网上论坛。
>



-- 
           Yours Sincerely
                   Zeng Hong

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

回复