anyway eval qq(qw($x $y)) works for me :)

2009/9/16 cnhack TNT <[email protected]>

> qw 不会做变量内插的操作的, qq 会,但是qq不会像 qw 那样按空格分隔返回包含多个元素的列表, 而请参看 perlop 中 Regexp
> Quote-Like Operators 章节中对于 qw 的描述
>
> 在你这个例子里,还是用 ($a, $b, $c ...) 这种方式吧:-)
>
>
> 2009/9/16 Michael Zeng <[email protected]>
>
>> catfile 不是接受数组元素么
>>
>> 按理 qw/ a  b / =  ( "a" , "b")  啊
>>
>>
>>
>>
>> 2009/9/16 cnhack TNT <[email protected]>
>>
>> qw// 本身就没那个功能,你得用 qq//;
>>>
>>> 2009/9/16 Michael Zeng <[email protected]>
>>>
>>>  怎么感觉catfile 接受参数数别挑剔?, 下面几种 都有点问题:
>>>>
>>>> #!/usr/bin/perl
>>>>
>>>> use strict ;
>>>> use warnings ;
>>>>
>>>> use File::Spec ;
>>>>
>>>>
>>>> my $a = 'ccc' ;
>>>> my $b = 'ddd'  ;
>>>> print File::Spec -> catfile ( qw/ $a  $b / ) ;   #  得到 $a/$b  : my god
>>>> ,   为什么不变量替换呢?
>>>>
>>>> 编译失败:
>>>> print File::Spec -> catfile ( $a , $b_2  ) ;
>>>>
>>>> 编译失败:
>>>> print File::Spec -> catfile ( $a , ${b}_2  ) ;
>>>>
>>>> 只有这一种是对的:
>>>> print File::Spec -> catfile ( $a , $b ) ; 但是没法对 $a , $b进行微操作,
>>>>
>>>> 感觉catfile 只支持 ,  分割参数,而且不能带一些变量变化,真是太弱了吧?
>>>>
>>>>
>>>> perl 5.10 和5.8 都这样,win32 或unix ,
>>>>
>>>>
>>>>
>>>> --
>>>>            Yours Sincerely
>>>>                    Zeng Hong
>>>>
>>>>
>>>>
>>>
>>>
>>
>>
>> --
>>            Yours Sincerely
>>                    Zeng Hong
>>
>>
>>
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
您收到此信息是由于您订阅了 Google 论坛“PerlChina Mongers 讨论组”论坛。
 要在此论坛发帖,请发电子邮件到 [email protected]
 要退订此论坛,请发邮件至 [email protected]
 更多选项,请通过 http://groups.google.com/group/perlchina?hl=zh-CN 访问该论坛
-~----------~----~----~----~------~----~------~--~---

回复