At 05:05 PM 6/10/02 -0700, drieux wrote:

>on http://thecgibin.com/index/faqs.shtml?Perl's_Quote_Words_Feature
>you make the assertion
>
>         my @peppers = (qw(green red yellow black cayenne));
>
>is this an old perlism???? since I have always done that as
>
>         my @peppers = qw(green red yellow black cayenne);
>
>since qw doesn't like 'scalar contexts' ...

Thanks Drieux, I didn't realize this. In fact I just tried it and get 
identical results on the command line with  both ways so your way seems 
better. Not sure I understand the issue with my way other than it being 
verbose. My way looks weird now that I look at it in light of your 
comment... I'm assigning to the list peppers a list of a list which seems 
to flatten out to just a list while your method simply assigns a list to 
the list peppers. Am I getting all that right?

I do see why I made this mistake though. I almost always use qw with for 
loops where I'd have to say

for(qw(hansel gretel witch)) {....}

and didn't think about those outer parens being unnecessary. Well I've 
changed it now - thank you much.

>or am I missing something here???

I'm flattered :). Isn't cool how Perl is soooo robust that we can get 
paranoid that something which looks like an oversight at best may actually 
be a sneaky way to do something?

Cheers,
Marty

--
SIMPL WebSite Creation: http://face2interface.com/Home/Demo.shtml


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to